<?php
/**
 * Created by PhpStorm.
 * User: guokunsheng
 * Date: 2020/11/16
 * Time: 10:47
 */

namespace app\common\lib\astrolog;

use app\common\lib\Util;
use think\Log;

/**
 * Class SynastryReport
 * @package app\common\lib\astrolog
 */
class SynastryReport extends LogicBase
{
    /**
     * 定义使用的星盘配置，保证不会变更
     * @var array[]
     */
    private $astroSetting = [
        // 本命盘配置
        'natal' => [
            'planet' => [
                [1, 8.5], [1, 7.5], [1, 3.5], [1, 3.5], [1, 4], [1, 4.5], [1, 4.5], [1, 2.5], [1, 2.5], [1, 2.5],
                [0, 0], [0, 0], [1, 2.5], [0, 0], [1, 2.5], [0, 0], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5]
            ],
            'phase' => [
                0 => [1, 0], 60 => [1, 0], 90 => [1, 0], 120 => [1, 0], 180 => [1, 0],
                45 => [0, 0], 135 => [0, 0], 30 => [0, 0], 150 => [0, 0], 72 => [0, 0], 144 => [0, 0]
            ],
            'arabic' => [
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]
            ],
            'h_sys' => 'p',
            'firdaria' => 'default',
            'bound_type' => 'default',
            'ecliptic' => 0,
            'profection_push_direction' => 0,
            'decanates' => 0,
            'ayanamsa' => 0,
            'location_use' => 0
        ],
        // 小限盘配置
        'profection' => [
            'planet' => [
                [1, 8.5], [1, 7.5], [1, 3.5], [1, 3.5], [1, 4], [1, 4.5], [1, 4.5], [1, 2.5], [1, 2.5], [1, 2.5],
                [0, 0], [0, 0], [0, 0], [0, 0], [1, 2.5], [0, 0], [0, 0], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5]
            ],
            'phase' => [
                0 => [1, 0], 60 => [1, 0], 90 => [1, 0], 120 => [1, 0], 180 => [1, 0],
                45 => [0, 0], 135 => [0, 0], 30 => [0, 0], 150 => [0, 0], 72 => [0, 0], 144 => [0, 0]
            ],
            'arabic' => [
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]
            ],
            'h_sys' => 'p',
            'firdaria' => 'default',
            'bound_type' => 'default',
            'ecliptic' => 0,
            'profection_push_direction' => 1,// 顺时针
            'decanates' => 0,
            'ayanamsa' => 0,
            'location_use' => 0
        ],
        // 法达盘配置
        'firdaria' => [
            'planet' => [
                [1, 8.5], [1, 7.5], [1, 3.5], [1, 3.5], [1, 4], [1, 4.5], [1, 4.5], [1, 2.5], [1, 2.5], [1, 2.5],
                [0, 0], [0, 0], [1, 2.5], [0, 0], [1, 2.5], [0, 0], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5]
            ],
            'phase' => [
                0 => [1, 0], 60 => [1, 0], 90 => [1, 0], 120 => [1, 0], 180 => [1, 0],
                45 => [0, 0], 135 => [0, 0], 30 => [0, 0], 150 => [0, 0], 72 => [0, 0], 144 => [0, 0]
            ],
            'arabic' => [
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]
            ],
            'h_sys' => 'p',
            'firdaria' => 'another',// 月交点在水星后
            'bound_type' => 'default',
            'ecliptic' => 0,
            'profection_push_direction' => 0,
            'decanates' => 0,
            'ayanamsa' => 0,
            'location_use' => 0
        ],
        // 三限盘配置
        'thirdprogressed' => [
            'planet' => [
                [1, 8.5], [1, 7.5], [1, 3.5], [1, 3.5], [1, 4], [1, 4.5], [1, 4.5], [1, 2.5], [1, 2.5], [1, 2.5],
                [0, 0], [0, 0], [0, 0], [0, 0], [1, 2.5], [0, 0], [0, 0], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5]
            ],
            'phase' => [
                0 => [1, 0], 60 => [1, 0], 90 => [1, 0], 120 => [1, 0], 180 => [1, 0],
                45 => [0, 0], 135 => [0, 0], 30 => [0, 0], 150 => [0, 0], 72 => [0, 0], 144 => [0, 0]
            ],
            'arabic' => [
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]
            ],
            'h_sys' => 'p',
            'firdaria' => 'default',
            'bound_type' => 'default',
            'ecliptic' => 0,
            'profection_push_direction' => 0,
            'decanates' => 0,
            'ayanamsa' => 0,
            'location_use' => 0
        ],
        // 次限盘配置
        'progressions' => [
            'planet' => [
                [1, 8.5], [1, 7.5], [1, 3.5], [1, 3.5], [1, 4], [1, 4.5], [1, 4.5], [1, 2.5], [1, 2.5], [1, 2.5],
                [0, 0], [0, 0], [0, 0], [0, 0], [1, 2.5], [0, 0], [0, 0], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5]
            ],
            'phase' => [
                0 => [1, 0], 60 => [1, 0], 90 => [1, 0], 120 => [1, 0], 180 => [1, 0],
                45 => [0, 0], 135 => [0, 0], 30 => [0, 0], 150 => [0, 0], 72 => [0, 0], 144 => [0, 0]
            ],
            'arabic' => [
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]
            ],
            'h_sys' => 'p',
            'firdaria' => 'default',
            'bound_type' => 'default',
            'ecliptic' => 0,
            'profection_push_direction' => 0,
            'decanates' => 0,
            'ayanamsa' => 0,
            'location_use' => 0
        ],
        // 组三盘配置
        'composite_thirdprogressed' => [
            'planet' => [
                [1, 8.5], [1, 7.5], [1, 3.5], [1, 3.5], [1, 4], [1, 4.5], [1, 4.5], [1, 2.5], [1, 2.5], [1, 2.5],
                [0, 0], [0, 0], [0, 0], [0, 0], [1, 2.5], [0, 0], [0, 0], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5]
            ],
            'phase' => [
                0 => [1, 0], 60 => [1, 0], 90 => [1, 0], 120 => [1, 0], 180 => [1, 0],
                45 => [0, 0], 135 => [0, 0], 30 => [0, 0], 150 => [0, 0], 72 => [0, 0], 144 => [0, 0]
            ],
            'arabic' => [
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]
            ],
            'h_sys' => 'p',
            'firdaria' => 'default',
            'bound_type' => 'default',
            'ecliptic' => 0,
            'profection_push_direction' => 0,
            'decanates' => 0,
            'ayanamsa' => 0,
            'location_use' => 0
        ],
        // 组次盘配置
        'composite_progressions' => [
            'planet' => [
                [1, 8.5], [1, 7.5], [1, 3.5], [1, 3.5], [1, 4], [1, 4.5], [1, 4.5], [1, 2.5], [1, 2.5], [1, 2.5],
                [0, 0], [0, 0], [0, 0], [0, 0], [1, 2.5], [0, 0], [0, 0], [1, 2.5], [1, 2.5], [1, 2.5], [1, 2.5]
            ],
            'phase' => [
                0 => [1, 0], 60 => [1, 0], 90 => [1, 0], 120 => [1, 0], 180 => [1, 0],
                45 => [0, 0], 135 => [0, 0], 30 => [0, 0], 150 => [0, 0], 72 => [0, 0], 144 => [0, 0]
            ],
            'arabic' => [
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
                [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]
            ],
            'h_sys' => 'p',
            'firdaria' => 'default',
            'bound_type' => 'default',
            'ecliptic' => 0,
            'profection_push_direction' => 0,
            'decanates' => 0,
            'ayanamsa' => 0,
            'location_use' => 0
        ],
    ];
    /**
     * 档案关系
     * 1单恋、2已恋、3分手、4已婚
     * @var int
     */
    private $relation = 0;
    /**
     * 档案1资料
     * @var array
     */
    private $recode1 = [];
    /**
     * 档案2资料
     * @var array
     */
    private $recode2 = [];
    /**
     * 推运时间
     * @var int
     */
    private $startTime = 0;
    /**
     * 调试模式 线上必须切换调试模式为1
     * @var int $debug =1 => 日志调试，一般用于线上  $debug=2 => 页面输出，用于本地调试
     */
    private $debug = 1;

    /**
     * 设置档案1
     * @param array $data
     * @return $this
     */
    public function setRecode1($data = []): self
    {
        !empty($data) && $this->recode1 = $data;

        return $this;
    }

    /**
     * 设置档案2
     * @param array $data
     * @return $this
     */
    public function setRecode2($data = []): self
    {
        !empty($data) && $this->recode2 = $data;

        return $this;
    }

    /**
     * 设置推运时间时间戳
     * 解锁日期距离下月1号大于10天，则以当月为起始；否则以下月1号为起始
     * @param int $timestamp
     * @return $this
     */
    public function setStartTime($timestamp = 0): self
    {
        if ($timestamp)
        {
            $year = date("Y", $timestamp);
            $month = date('m', $timestamp);
            // 下月1号0点时间戳
            $nextMonthStarttime = strtotime(date('Y-m-d', mktime(0, 0, 0, +($month + 1), 1, $year)));
            // 距离下个月1号小于等于10天时，推运时间取下个月
            if ($nextMonthStarttime - $timestamp <= 86400 * 10)
            {
                $this->startTime = $nextMonthStarttime;
            } else
            {
                $this->startTime = strtotime(date('Y-m-d', mktime(0, 0, 0, $month, 1, $year)));
            }
        }

        return $this;
    }

    /**
     * 设置推运星盘时间
     * @param int $timestamp
     * @return array
     */
    public function setAdvance($timestamp = 0): array
    {
        // 格式化推运时间
        $advance = [
            'year' => date('Y', $timestamp),
            'month' => date('m', $timestamp),
            'day' => date('d', $timestamp),
            'hour' => date('H', $timestamp),
            'minute' => date('i', $timestamp),
            'timezone' => 8,// 写死东八区
        ];
        $advance['is_summer'] = isSummerTime($advance['hour'], $advance['minute'], 0, $advance['month'], $advance['day'], $advance['year']) ? 1 : 0;

        return $advance;
    }

    /**
     * 设置档案关系
     * 根据关系计算四种不同的报告 1单恋、2已恋、3分手、4已婚
     * @param int $relation
     * @return $this
     */
    public function setRelation($relation = 0): self
    {
        if ($relation !== 0)
        {
            $this->relation = $relation;
        }
        return $this;
    }

    /**
     * 获取报告数据
     * @return array
     */
    public function getReportData(): array
    {
        $res = [];
        if (empty($this->recode1) || empty($this->recode2))
        {
            Log::write('计算合盘报告：档案缺失', 'error', true);
            return $res;
        }
//        $this->setDebugLog('档案1：' . json_encode($this->recode1, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
//        $this->setDebugLog('档案2：' . json_encode($this->recode2, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
//        $this->setDebugLog("
//        <table border='1' cellpadding='10' cellspacing='0'>
//            <tr>
//                <td>名称</td>
//                <td>{$this->recode1['name']}</td>
//                <td>{$this->recode2['name']}</td>
//            </tr>
//            <tr>
//                <td>性别</td>
//                <td>{$this->recode1['type']}</td>
//                <td>{$this->recode2['type']}</td>
//            </tr>
//            <tr>
//                <td>出生时间</td>
//                <td>{$this->recode1['year']}-{$this->recode1['month']}-{$this->recode1['day']} {$this->recode1['hour']}:{$this->recode1['minute']}</td>
//                <td>{$this->recode1['year']}-{$this->recode1['month']}-{$this->recode1['day']} {$this->recode1['hour']}:{$this->recode1['minute']}</td>
//            </tr>
//            <tr><td>夏令时</td><td>{$this->recode1['is_summer']}</td><td>{$this->recode2['is_summer']}</td></tr>
//            <tr>
//                <td>出生地</td>
//                <td>{$this->recode1['birth_country']}{$this->recode1['birth_province']}{$this->recode1['birth_city']} {$this->recode1['long_deg']}˚{$this->recode1['long_min']} {$this->recode1['lat_deg']}˚{$this->recode1['lat_min']}</td>
//                <td>{$this->recode2['birth_country']}{$this->recode2['birth_province']}{$this->recode2['birth_city']} {$this->recode2['long_deg']}˚{$this->recode2['long_min']} {$this->recode2['lat_deg']}˚{$this->recode2['lat_min']}</td>
//            </tr>
//            <tr>
//                <td>现居地</td>
//                <td>{$this->recode1['live_country']}{$this->recode1['live_province']}{$this->recode1['live_city']}</td>
//                <td>{$this->recode2['live_country']}{$this->recode2['live_province']}{$this->recode2['live_city']}</td>
//            </tr>
//        </table>
//");

        switch ($this->relation)
        {
            case 2: //正在热恋
                $res = $this->getState2Data();
                break;
            case 3: // 已经分手
                $res = $this->getState3Data();
                break;
            case 4: // 步入婚姻
                $res = $this->getState4Data();
                break;
            default: //暗恋对象
                $res = $this->getState1Data();
                break;
        }

        return $res;
    }

    /**
     * debug输出
     * @param string $log
     */
    private function setDebugLog(string $log = ''): void
    {
        if ($this->debug === 1)
        {
            Log::write('debug: ' . $log, 'info', true);
        } elseif ($this->debug === 2)
        {
            echo 'debug: ' . $log . (IS_CLI ? PHP_EOL : '<br/>');
        }
    }

    /**
     * 获取合盘报告所需星盘数据
     * @param string[] $charts
     * @return array
     */
    protected function getAstroDatas($charts = ['natal']): array
    {
        $file = $this->recode1['id'] . '_' . $this->recode2['id'] . '.json';

        $dir = 'sysnastry_report';

        $filePath = RUNTIME_PATH . $dir . DS;
        // 本地调试时
        if ($this->debug === 2 && file_exists($filePath . $file))
        {
            $data = json_decode(file_get_contents($filePath . $file), true);
        } else
        {
//            ini_set('memory_limit', '4096M');
//            set_time_limit(0);
            $Astrolog = Astrolog::getInstance()
                ->setExecPrefix(config('astrolog.prefix'))
                // 设置星盘配置
                ->setUserSetting($this->astroSetting)
                // 设置为true获取星盘结构数据与互容接纳数据
                ->setIsAstrolabe(true)
                // version>1会计算行星中点相位、光线围攻、夹宫、夹星、夹制、夹辅
                ->setVersion(1);

            $data = [];
            foreach ($charts as $chart)
            {
                $Astrolog->setGetDatas([$chart]);
                switch ($chart)
                {
                    // 本命盘不需要设置推运时间
                    case 'natal':
                        $data[$chart][0] = $Astrolog
                            ->setRecode1($this->recode1)
                            ->setRecode2($this->recode2)
                            ->getAstroDatas()
                            ->getDatas($chart);
                        $data[$chart][1] = $Astrolog
                            ->setRecode1($this->recode2)
                            ->setRecode2($this->recode1)
                            ->getAstroDatas()
                            ->getDatas($chart);
                        break;
                    // 法达盘、小限盘需要设置推运时间
                    case 'firdaria':
                    case 'profection':
                        $advance = $this->setAdvance($this->startTime);
                        $data[$chart][0] = $Astrolog
                            ->setRecode1($this->recode1)
                            ->setRecode2($this->recode2)
                            ->setAdvance($advance)
                            ->getAstroDatas()
                            ->getDatas($chart);
                        $data[$chart][1] = $Astrolog
                            ->setRecode1($this->recode2)
                            ->setRecode2($this->recode1)
                            ->setAdvance($advance)
                            ->getAstroDatas()
                            ->getDatas($chart);
                        break;
                    // 三限盘、组合三限盘 需要设置推运时间 获取12个月，每个月获取三个盘7、14、21号每天12点
                    case 'thirdprogressed':
                        $starttime = $this->startTime;
                        $endtime = strtotime('+1 year', $starttime);
                        $step = '+1 month';
                        do
                        {
                            $year = date("Y", $starttime);
                            $month = date('m', $starttime);
                            // 推运时间
                            $advance = $this->setAdvance(strtotime(date('Y-m-d H:i:s', mktime(12, 0, 0, $month, 7, $year))));
                            $tmpData = [];
                            // 档案1星盘数据
                            $data[$chart][0][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode1)
                                ->setRecode2($this->recode2)
                                ->getAstroDatas()
                                ->getDatas($chart);
                            // 档案2星盘数据
                            $data[$chart][1][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode2)
                                ->setRecode2($this->recode1)
                                ->getAstroDatas()
                                ->getDatas($chart);
                            // 推运时间
                            $advance = $this->setAdvance(strtotime(date('Y-m-d H:i:s', mktime(12, 0, 0, $month, 14, $year))));
                            // 档案1星盘数据
                            $data[$chart][0][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode1)
                                ->setRecode2($this->recode2)
                                ->getAstroDatas()
                                ->getDatas($chart);
                            // 档案2星盘数据
                            $data[$chart][1][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode2)
                                ->setRecode2($this->recode1)
                                ->getAstroDatas()
                                ->getDatas($chart);
                            // 推运时间
                            $advance = $this->setAdvance(strtotime(date('Y-m-d H:i:s', mktime(12, 0, 0, $month, 21, $year))));
                            // 档案1星盘数据
                            $data[$chart][0][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode1)
                                ->setRecode2($this->recode2)
                                ->getAstroDatas()
                                ->getDatas($chart);
                            // 档案2星盘数据
                            $data[$chart][1][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode2)
                                ->setRecode2($this->recode1)
                                ->getAstroDatas()
                                ->getDatas($chart);

                            $starttime = strtotime($step, $starttime);
                        } while ($starttime < $endtime);
                        break;
                    case 'composite_thirdprogressed':
                        $starttime = $this->startTime;
                        $endtime = strtotime('+1 year', $starttime);
                        $step = '+1 month';
                        do
                        {
                            $year = date("Y", $starttime);
                            $month = date('m', $starttime);
                            // 推运时间
                            $advance = $this->setAdvance(strtotime(date('Y-m-d H:i:s', mktime(12, 0, 0, $month, 7, $year))));
                            $tmpData = [];
                            // 档案1星盘数据
                            $data[$chart][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode1)
                                ->setRecode2($this->recode2)
                                ->getAstroDatas()
                                ->getDatas($chart);
                            // 推运时间
                            $advance = $this->setAdvance(strtotime(date('Y-m-d H:i:s', mktime(12, 0, 0, $month, 14, $year))));
                            // 档案1星盘数据
                            $data[$chart][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode1)
                                ->setRecode2($this->recode2)
                                ->getAstroDatas()
                                ->getDatas($chart);
                            // 推运时间
                            $advance = $this->setAdvance(strtotime(date('Y-m-d H:i:s', mktime(12, 0, 0, $month, 21, $year))));
                            // 档案1星盘数据
                            $data[$chart][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode1)
                                ->setRecode2($this->recode2)
                                ->getAstroDatas()
                                ->getDatas($chart);

                            $starttime = strtotime($step, $starttime);
                        } while ($starttime < $endtime);
                        break;
                    // 次限、组合次限盘 需要设置推运时间，获取每个月14号
                    case 'progressions':
                        $starttime = $this->startTime;
                        $endtime = strtotime('+1 year', $starttime);
                        $step = '+1 month';
                        do
                        {
                            $year = date("Y", $starttime);
                            $month = date('m', $starttime);
                            // 推运时间
                            $advance = $this->setAdvance(strtotime(date('Y-m-d H:i:s', mktime(12, 0, 0, $month, 14, $year))));
                            // 档案1星盘数据
                            $data[$chart][0][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode1)
                                ->setRecode2($this->recode2)
                                ->getAstroDatas()
                                ->getDatas($chart);
                            // 档案1星盘数据
                            $data[$chart][1][] = $Astrolog
                                ->setAdvance($advance)
                                ->setRecode1($this->recode2)
                                ->setRecode2($this->recode1)
                                ->getAstroDatas()
                                ->getDatas($chart);

                            $starttime = strtotime($step, $starttime);
                        } while ($starttime < $endtime);
                        break;
                    case 'composite_progressions':
                        $starttime = $this->startTime;
                        $endtime = strtotime('+1 year', $starttime);
                        $step = '+1 month';
                        do
                        {
                            $year = date("Y", $starttime);
                            $month = date('m', $starttime);
                            // 推运时间
                            $advance = $this->setAdvance(strtotime(date('Y-m-d H:i:s', mktime(12, 0, 0, $month, 14, $year))));
                            // 档案1星盘数据
                            $data[$chart][] = $Astrolog
                                ->setAdvance($advance)
                                ->getAstroDatas()
                                ->getDatas($chart);

                            $starttime = strtotime($step, $starttime);
                        } while ($starttime < $endtime);
                        break;
                    default:
                        break;
                }
            }
            // 本地调试时，生成星盘数据文件缓存
            $this->debug === 2 && Util::createFile($file, json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), $dir);
        }
        return $data;
    }

    /**
     * 单恋状态
     */
    private function getState1Data(): array
    {
        $tags = [
            'start_time' => $this->startTime,
            'tpoics' => [
                0 => [
                    'text' => [],
                    'level' => [],
                ],
                1 => [
                    'text' => [],
                    'level' => [],
                ],
                2 => [
                    'text' => [],
                    'level' => [],
                ],
                3 => [
                    'text' => [],
                    'level' => [],
                ],
                4 => [
                    'text' => [],
                    'level' => [],
                ],
                5 => [
                    'text' => [],
                    'level' => [],
                ],
            ],
        ];
        /**
         * 获取当前所需星盘数据
         */
        $astroData = $this->getAstroDatas([
            'natal',
            'profection',
            'firdaria',
            'thirdprogressed',
            'progressions',
            'composite_thirdprogressed',
            'composite_progressions'
        ]);
        $astroData = json_decode(json_encode($astroData, true), true);
        $natal = $astroData['natal'];
        $profection = $astroData['profection'];
        $firdaria = $astroData['firdaria'];
        $thirdprogressed = $astroData['thirdprogressed'];
        $progressions = $astroData['progressions'];
        $composite_thirdprogressed = $astroData['composite_thirdprogressed'];
        $composite_progressions = $astroData['composite_progressions'];
        //主题 1、关系升温的月份
        // A、法达星限（调用档案1法达星限）：
        //①若该副限行星为金/月、5R/7R、落5R/7R内、互容接纳5R/7R/57R宫内星（词条总数 1）
        //②若该副限行星被火土天海冥刑克(无互容接纳)、接纳互容火/土(非5/7R，5/7宫内星) （词条总数 1）
        //③非以上情况（词条总数 1）
        //调用逻辑：取解锁报告月份的当前年份，满足条件即可调用词条，仅调用一条，若不满足①②则取③
        //  词条示例：对于你个人而言，今年是有利于你推进桃花感情发展的年份。在这基础影响之下：
//        $tag1A = $this->getSection1($firdaria[0], $natal[0]);
        // 主题1词条
//        $tags['tpoics'][0]['text']['A'][] = 10000000 + $tag1A;

        //	B、组合次限：取1年期（以下订单的当前月开始计12 个月为 1 年）
        //①月亮在 1、4/5/7、10/ 6、8/ 3、11宫，与（太阳/金星形成0/60/120度）（词条总数 5*1）
        //②月亮在 1、4/5/7、10/ 6、8/ 3、11宫，与（太阳/金星形成90/180度）（词条总数 5*1）
        //③非以上情况+0 分（词条总数1 ）
        //调用逻辑：
        //  1、以下单当月计 12 个月为一年，依次每月取相位最紧密的词条，12 个月最终只调用 1 个词条
        //  2、优先排序：取用优先级：精准相位＞弱相位（入相＞出相）＞空相
        //  3、首取满足条件①或②的词条，若当年都不满足，则取③的词条，仅一条。
        //  4、若 12 个月份中有多个满足条件①②存在，则取持续月份最多的词条
        //		词条示例：XX 年是有利于你们推进关系发展的年份，彼此相处容易感觉到愉快轻松；
        $housesKey = [1 => 0, 3 => 4, 4 => 0, 5 => 1, 6 => 3, 7 => 2, 8 => 3, 10 => 2, 11 => 4];
        $time = $this->startTime;
        $tag1_B = [
            1 => ['h' => 1, 'c1' => 0, 'c2' => 0, 'c3' => 0], 3 => ['h' => 3, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            4 => ['h' => 4, 'c1' => 0, 'c2' => 0, 'c3' => 0], 5 => ['h' => 5, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            6 => ['h' => 6, 'c1' => 0, 'c2' => 0, 'c3' => 0], 7 => ['h' => 7, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            8 => ['h' => 8, 'c1' => 0, 'c2' => 0, 'c3' => 0], 10 => ['h' => 10, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            11 => ['h' => 11, 'c1' => 0, 'c2' => 0, 'c3' => 0]
        ];
        $tag1B0Num = 0;// 满足条件1的数量
        $tag1B1Num = 0;// 满足条件2的数量
        $tag1B2Num = 0;// 满足条件3的数量
        foreach ($composite_progressions as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            // 反向判断，不在2、9、12宫
            if (!$this->isPlanetInHouse($v1['planets'], 1, [2, 9, 12]))
            {
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 0, [0, 60, 120])
                    || $this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 120]))
                {
                    $tag1B0Num++;
                    $tag1_B[$v1MoonHouse]['c1']++;
                } elseif ($this->isPlanetPhasePlanet($v1['planets'], 1, 0, [90, 180])
                    || $this->isPlanetPhasePlanet($v1['planets'], 1, 3, [90, 180]))
                {
                    $tag1B1Num++;
                    $tag1_B[$v1MoonHouse]['c2']++;
                } else
                {
                    $tag1B2Num++;
                    $tag1_B[$v1MoonHouse]['c3']++;
                }
            } else
            {
                $tag1B2Num++;
            }
            $time = strtotime('+1 month', $time);
        }
        // 12个月中没有满足条件1和条件2的
        if ($tag1B2Num === 12)
        {
            $tags['tpoics'][0]['text']['B'][] = 10000102;
        } else
        {
            // 重置索引
            $tag1_B = array_merge($tag1_B);
            if ($tag1B0Num > $tag1B1Num)
            {
                $tag1_B = resort($tag1_B, 'c1', 'DESC');
                $key = 1000010000;
            } elseif ($tag1B0Num === $tag1B1Num)
            {
                $tag1_B = resort($tag1_B, 'c1', 'DESC');
                $key = 1000010000;
                $tags['tpoics'][0]['text']['B'][] = $key + $housesKey[$tag1_B[0]['h']];

                $tag1_B = resort($tag1_B, 'c2', 'DESC');
                $key = 1000010100;
            } else
            {
                $tag1_B = resort($tag1_B, 'c2', 'DESC');
                $key = 1000010100;
            }
            $tags['tpoics'][0]['text']['B'][] = $key + $housesKey[$tag1_B[0]['h']];
        }

        //	C、组合三限：取 12 个月（以下订单的当前月开始计 12 个月）有图形
        //①月亮在 1、4/5/7、10/6、8/3、11宫，与太阳/金星/日金形成（0/60/120度）（词条总数 5*3条，调用词条多条）
        //②月亮在 1、4/5/7、10/6、8/3、11宫，与太阳/金星/日金形成（90/180度 ）词条总数 5*3条，调用词条多条）
        //③非以上情况+0 分（词条总数1 条）
        //新增标注：与太阳/金星/日金形成（0/60/120度）或（90/180度 ）的情况具体为：
        //若与日成相，且不与金成相
        //若与金成相，且不与日成相
        //若同时与日金成相，只需满足括弧内相位，不必相同
        //若同时与日金成相，相位分别为（0/60/120度）或（90/180度 ），则取相位容许度最紧密；
        //调用逻辑：
        //  1、首取满足①②条件的月份，1 个月份仅调用1 条，满足条件的月份即可调用，不满足则不调用；
        //  2、若 12 个月全都不满足①②，则取③的词条，仅 1 条；
        //  3、若连续几个月均为满足①，或②，则直接仅调用 1 个对应词条，不重复调用，并在前面标注满足的年份月份；
        //  4、优先排序：取用优先级：精准相位＞弱相位（入相＞出相）＞空相
        //		词条示例：在 XX 月，你们之间的关系可以有小幅度的推进，对方可能会对你非常有感觉，尤其是当你们多多交流的时候，更能让对方感觉到你的内在美，因此对你另眼相看
        $housesKey = ['1' => 0, '3' => 4, '4' => 0, '5' => 1, '6' => 3, '7' => 2, '8' => 3, '10' => 2, '11' => 4];
        $planetsKey = ['0' => 0, '3' => 1, '0,3' => 2];
        $time = $this->startTime;
        $tag1cTmp = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (empty($tag1cTmp[$date]))
            {
                $tag1cTmp[$date] = [
                    'date' => $date,
                    'house' => $v1MoonHouse,
                    'phase_id' => null,
                    'phase_e' => null,
                    'phase_orb' => null,
                ];
            }
            if (!$this->isPlanetInHouse($v1['planets'], 1, [2, 9, 12])
//                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 4, [90, 180])
//                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 6, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 7, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 8, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 9, [90, 180])
            )
            {
                $isPhaseSun = isset($v1['planets'][1]['phase']['1-0']);
                $isPhaseVenu = isset($v1['planets'][1]['phase']['1-3']);
                // 与日金同时成相
                if ($isPhaseSun && $isPhaseVenu)
                {
                    // 与太阳相位更紧密
                    if ($v1['planets'][1]['phase']['1-0']['phase_orb'] <= $v1['planets'][1]['phase']['1-3']['phase_orb'])
                    {
                        if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                        {
                            $tag1cTmp[$date] = [
                                'date' => $date,
                                'house' => $v1MoonHouse,
                                'phase_id' => '0,3',
                                'phase_e' => $v1['planets'][1]['phase']['1-0']['phase_e'],
                                'phase_orb' => $v1['planets'][1]['phase']['1-0']['phase_orb'],
                            ];
                        }
                    }// 与金星相位更紧密
                    else
                    {
                        if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                        {
                            $tag1cTmp[$date] = [
                                'date' => $date,
                                'house' => $v1MoonHouse,
                                'phase_id' => '0,3',
                                'phase_e' => $v1['planets'][1]['phase']['1-3']['phase_e'],
                                'phase_orb' => $v1['planets'][1]['phase']['1-3']['phase_orb'],
                            ];
                        }
                    }
                }// 仅与太阳成相
                elseif ($isPhaseSun && !$isPhaseVenu)
                {
                    if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                    {
                        $tag1cTmp[$date] = [
                            'date' => $date,
                            'house' => $v1MoonHouse,
                            'phase_id' => 0,
                            'phase_e' => $v1['planets'][1]['phase']['1-0']['phase_e'],
                            'phase_orb' => $v1['planets'][1]['phase']['1-0']['phase_orb'],
                        ];
                    }
                }// 仅与金星成相
                elseif (!$isPhaseSun && $isPhaseVenu)
                {
                    if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                    {
                        $tag1cTmp[$date] = [
                            'date' => $date,
                            'house' => $v1MoonHouse,
                            'phase_id' => 3,
                            'phase_e' => $v1['planets'][1]['phase']['1-3']['phase_e'],
                            'phase_orb' => $v1['planets'][1]['phase']['1-3']['phase_orb'],
                        ];
                    }
                }
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        $num = 0;
        foreach ($tag1cTmp as $d => $tct)
        {
            if (in_array($tct['phase_e'], [0, 60, 120], true))
            {
                $num++;
                $s = 5;
                $tags['tpoics'][0]['text']['C'][] = [
                    'date' => $d,
                    'code' => 100002000000 + $housesKey[$tct['house']] * 100 + $planetsKey[$tct['phase_id']],
                ];
            } elseif ($tct['phase_e'] !== null)
            {
                $num++;
                $s = 3;
                $tags['tpoics'][0]['text']['C'][] = [
                    'date' => $d,
                    'code' => 100002010000 + $housesKey[$tct['house']] * 100 + $planetsKey[$tct['phase_id']],
                ];
            } else
            {
                $s = 0;
            }
            $tags['tpoics'][0]['level'][] = $s;
        }
        // 12个月前两个条件都不满足，则取条件3，仅出一个词条
        if ($num === 0)
        {
            $tags['tpoics'][0]['text']['C'][] = ['date' => '', 'code' => 10000202];
        }

        //主题 2、关系受阻的月份
        //	A、组合次限：取1年期（以下订单的当前月开始计12 个月为 1 年）
        //①月亮在 2/1、5、9、11/6、10/7/4、8/12宫，与（火土/土星）形成任意相位，不与日金有相位（词条总数 6*1）
        //②月亮在 2/1、5、9、11/6、10/7/4、8/12宫，与（天/海/冥）形成任意相位，不与日金有相位（词条总数6*1）
        //③非以上情况+0 分（调用词条1 条）
        //调用逻辑：
        //  1、以下单当月计 12 个月为一年，依次每月取相位最紧密的词条，12 个月最终只调用 1 个词条
        //  2、优先排序：取用优先级：精准相位＞弱相位（入相＞出相）＞空相
        //  3、首取满足条件①或②的词条，若当年都不满足，则取③的词条，仅一条。
        //  4、若 12 个月份中有多个满足条件①②存在，则取持续月份最多的词条
        //		词条示例：XX 年会不利于你们推进关系发展的年份，彼此相处容易感觉到纠结无趣；
        $time = $this->startTime;
        $tag2A = [
            ['key' => 0, 'num' => 0, 'data' => []],
            ['key' => 1, 'num' => 0, 'data' => []],
            ['key' => 2, 'num' => 0, 'data' => []],
        ];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (!$this->isPlanetInHouse($v1['planets'], 1, [3, 11])
                && !isset($v1['planets'][1]['phase']['1-0'])
                && !isset($v1['planets'][1]['phase']['1-3']))
            {
                if (isset($v1['planets'][1]['phase']['1-4'])
                    || isset($v1['planets'][1]['phase']['1-6']))
                {
                    $tag2A[0]['num']++;
                    $tag2A[0]['data'][] = $v1MoonHouse;
                } elseif (isset($v1['planets'][1]['phase']['1-7'])
                    || isset($v1['planets'][1]['phase']['1-8'])
                    || isset($v1['planets'][1]['phase']['1-9']))
                {
                    $tag2A[1]['num']++;
                    $tag2A[1]['data'][] = $v1MoonHouse;
                } else
                {
                    $tag2A[2]['num']++;
                    $tag2A[2]['data'][] = $v1MoonHouse;
                }
            } else
            {
                $tag2A[2]['num']++;
                $tag2A[2]['data'][] = $v1MoonHouse;
            }
            $time = strtotime('+1 month', $time);
        }
        if ($tag2A[2]['num'] === 12)
        {
            $tags['tpoics'][1]['text']['A'][] = 10010002;
        } else
        {
            unset($tag2A[2]);
            $tag2A = resort($tag2A, 'num', 'DESC');
            $tag2A0Num = array_count_values($tag2A[0]['data']);
            // 若条件1与条件2次数一样
            if ($tag2A[0]['num'] === $tag2A[1]['num'])
            {
                $hs = array_merge($tag2A[0]['data'], $tag2A[1]['data']);
                $hs_count_value = array_count_values($hs);
                // 查询出现最多次的宫位id
                $hs_more_value = key($hs_count_value);
                $tag2A1Num = array_count_values($tag2A[1]['data']);
                if (isset($tag2A1Num[$hs_more_value]) && $tag2A1Num[$hs_more_value] > $tag2A0Num[$hs_more_value])
                {
                    $tag2A[0] = $tag2A[1];
                    $tag2A0Num = $tag2A1Num;
                }
            }
            $housesKey = ['1' => 1, '2' => 0, '4' => 4, '5' => 1, '6' => 2, '7' => 3, '8' => 4, '9' => 1, '10' => 2, '12' => 5];
            $tags['tpoics'][1]['text']['A'][] = 1001000000 + $tag2A[0]['key'] * 100 + $housesKey[key($tag2A0Num)];
        }

        //	B、组合三限：取 12 个月（以下订单的当前月开始计 12 个月）有图形
        //①月亮在 2/1、5、9/6、10/7/4、8/12宫，与（火星/土星）形成任意相位，不与日、金有现代相位（词条总数6*1条）+3分
        //②月亮在 2/1、5、9/6、10/7/4、8/12宫，与（天/海/冥）形成任意相位，不与日、金有相位（词条总数6*1条）+5 分
        //③非以上情况+0 分（词条总数1 ）
        //调用逻辑：
        //  1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 7 号为推运起始时间
        //  2、组合三限盘取用：以下单当月计 12 个月为一年，每月从7、14、21日三个盘中取1 个最紧密相位。
        //  3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //  4、词条调用：A 逻辑最终输出多条，首取满足①②条件的月份，1 个月份仅调用1 条，满足条件的月份即可调用，不满足则不调用；
        //  5、若 12 个月都不满足①或②，则取③的词条，仅 1 条；
        //  6、若连续几个月均满足①，或②的同一条件，则直接仅调用 1 个对应词条，不重复调用，在前面标注满足的年份；
        //固定语示例：对于你们双方的关系而言，在接下来一年具体来看，容易出现不利于关系进展的月份是：XX年XX月;
        //在XX年XX月的时候+词条
        $time = $this->startTime;
        $tag2bTmp = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            $tag2bTmp[$date] = [
                'date' => $date,
                'house' => $v1MoonHouse,
                'phase_id' => null,
                'phase_e' => null,
                'phase_orb' => null,
            ];
            // 不与日金成相
            if (!$this->isPlanetInHouse($v1['planets'], 1, [3])
                && (!isset($v1['planets'][1]['phase']['1-0'])
                    || $this->checkMordenPhase($v1['planets'][1]['phase']['1-0']['phase_e'], $v1['planets'][1]['phase']['1-0']['phase_orb']))
                && (!isset($v1['planets'][1]['phase']['1-3'])
                    || $this->checkMordenPhase($v1['planets'][1]['phase']['1-3']['phase_e'], $v1['planets'][1]['phase']['1-3']['phase_orb'])))
            {
                if (isset($v1['planets'][1]['phase']['1-4'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-4']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 4;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-4']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-4']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-6'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-6']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 6;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-6']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-6']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-7'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-7']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 7;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-7']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-7']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-8'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-8']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 8;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-8']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-8']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-9'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-9']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 9;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-9']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-9']['phase_orb'];
                }
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        $nullNum = 0;
        $housesKey = ['1' => 1, '2' => 0, '4' => 4, '5' => 1, '6' => 2, '7' => 3, '8' => 4, '9' => 1, '10' => 2, '11' => 1, '12' => 5];
        foreach ($tag2bTmp as $d => $t2bt)
        {
            $s = 0;
            if ($t2bt['phase_id'] !== null && (empty($tmp) || $t2bt['phase_orb'] < $tmp['phase_orb']))
            {
                $tmp = $t2bt;
            }
            if (in_array($t2bt['phase_id'], [4, 6], true))
            {
                $s = 3;
                $tags['tpoics'][1]['text']['B'][] = [
                    'date' => $d,
                    'code' => 1001010000 + $housesKey[$t2bt['house']],
                ];
            } elseif (in_array($t2bt['phase_id'], [7, 8, 9], true))
            {
                $s = 5;
                $tags['tpoics'][1]['text']['B'][] = [
                    'date' => $d,
                    'code' => 1001010100 + $housesKey[$t2bt['house']],
                ];
            } else
            {
                $nullNum++;
            }
            $tags['tpoics'][1]['level'][] = $s;
        }
        if ($nullNum === 12)
        {
            $tags['tpoics'][1]['text']['B'][] = [
                'date' => '',
                'code' => 10010102
            ];
        }

        //C、若主题1的 C、主题2的 B 出现相同月份，则单出1 个词条
        //固定语示例：需要注意在 XX 月份的日子+词条
        if (!empty($tags['tpoics'][0]['text']['C']) && !empty($tags['tpoics'][1]['text']['B']))
        {
            $sameMonth = [];
            foreach ($tags['tpoics'][0]['text']['C'] as $k1 => $t2a)
            {
                foreach ($tags['tpoics'][1]['text']['B'] as $k2 => $t2b)
                {
                    if ($t2a['date'] === $t2b['date'])
                    {
                        $sameMonth[] = $t2a['date'];
                    }
                }
            }
            if (!empty($sameMonth))
            {
                $tags['tpoics'][1]['text']['C'][] = [
                    'date_list' => $sameMonth,
                    'code' => 100102
                ];
            } else
            {
                $tags['tpoics'][1]['text']['C'] = [];
            }
        } else
        {
            $tags['tpoics'][1]['text']['C'] = [];
        }

        //主题 3、关系遇到的阻碍
        //组合次限：取 12 个月（以下订单的当前月开始计 12 个月为一年）
        //①月亮落1-12宫，与日、金/水、木（90/180）、与火、土/天、海、冥的（0/90/180）（词条总数 12*4条）
        //②月亮在1-12宫（词条总数12条）
        //③月亮空相（词条总数 1条）
        //调用逻辑：
        //  1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //  2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个组合次限盘。
        //  3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相，且持续时间＞4 个月
        //  4、词条调用：该逻辑最终输出仅 1 个词条，首看是否满足条件③，若不满足③条件，则取①条件，若都不满足③或①的条件，则取②。
        //  5、若 12 个月份中有多个月份满足条件①或②，则取持续月份最多的条件；
        //  若满足月份等同，则按照3 的优先排序取用
        //固定语示例：
        //在接下来一年里，阻碍你们的关系推进的原因是+词条
        $time = $this->startTime;
        $tag3 = [];
        $nullNum = 0;
        $housesArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (empty($v1['planets'][1]['phase']))
            {
                $nullNum++;
            } else
            {
                foreach ($v1['planets'][1]['phase'] as $k2 => $phase)
                {
                    if ($phase['id'] > 9)
                    {
                        unset($v1['planets'][1]['phase'][$k2]);
                    }
                }
                $housesArr[$v1MoonHouse]++;
                if (count($v1['planets'][1]['phase']) > 0)
                {
                    $v1MoonPhase = resort(array_values($v1['planets'][1]['phase']), 'phase_orb', 'ASC');
                    $tag3[0][] = [
                        'date' => $date,
                        'house' => $v1MoonHouse,
                        'phase_id' => $v1MoonPhase[0]['id'],
                    ];
                } else
                {
                    $nullNum++;
                    $tag3[1][] = [
                        'date' => $date,
                        'house' => $v1MoonHouse,
                        'phase_id' => null,
                    ];
                }
            }
            $time = strtotime('+1 month', $time);
        }
        // 若12个月均为空相
        if ($nullNum === 12)
        {
            $tags['tpoics'][2]['text'][] = 10020002;
        } else
        {
            if (isset($tag3[0], $tag3[1]) && count($tag3[0]) >= count($tag3[1]))
            {
                $tag3[0] = $tag3[1];
            }
            // 获取持续最多的宫位
            $maxHouse = array_search(max($housesArr), $housesArr, true);
            $phaseNum = 0;
            $phaseArray = [];
            if (isset($tag3[0]) && !empty($tag3[0]))
            {
                foreach ($tag3[0] as $k1 => $v1)
                {
                    if ($v1['house'] === $maxHouse && $v1['phase_id'] !== null)
                    {
                        $phaseNum++;
                        $phaseArray[] = $v1['phase_id'];
                    }
                }
            }
            if ($phaseNum)
            {
                $morePhasePlanets = array_count_values($phaseArray);
                $morePhasePlanet = array_search(max($morePhasePlanets), $morePhasePlanets, true);
                $phasePlanetArray = [0 => 0, 2 => 1, 3 => 0, 4 => 2, 5 => 1, 6 => 2, 7 => 3, 8 => 3, 9 => 3];
                $tags['tpoics'][2]['text'][] = 100200000000 + ($maxHouse - 1) * 100 + $phasePlanetArray[$morePhasePlanet];
            } else
            {
                $tags['tpoics'][2]['text'][] = 1002000100 + ($maxHouse - 1);
            }
        }

        //主题 4、关系能否进一步
        //	组合次限：取 12 个月（以下订单的当前月开始计 12 个月）
        //①月亮与金星/日金，任意相位（词条总数1条）
        //②月亮与水星/日水，任意相位（词条总数1条）
        //③月亮与火星/金火，任意相位（词条总数1条）
        //④月亮与木星，任意相位（词条总数1条）
        //⑤月亮与太阳，任意相位（词条总数1条）
        //⑥月亮无相位 单个词条（词条总数1条）
        //调用逻辑：
        //  1、以下单当月计 12 个月为一年，依次每月取相位最紧密的词条，12 个月最终只调用 1 个词条
        //  2、若不属于条件①-⑤，则取条件⑥词条
        //  3、首取时间最长的，若有均等时间，则可取两个词条。
        //  4、若月亮同时与日金有相位，则直接取①词条; 若月亮同时与金火有相位，则直接取③词条
        //  5、取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //		词条示例：
        //今年你们的关系在 XX 方面非常好，能够带来在 XX 方面的进一步推进，具体表现为，你们很可能会有情感层面的互有好感，只要稍作一些努力就能对关系的发展有帮助；彼此也可能会在这期间互相爱慕，能够高度的认同彼此。
        $time = $this->startTime;
        $tag4Tmp = [0, 0, 0, 0, 0, 0];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $section4_tag = 5;
            $section4_min_phase_orb = 100;
            if (isset($v1['planets'][1]['phase']['1-3']) && $v1['planets'][1]['phase']['1-3']['phase_orb'] < $section4_min_phase_orb)
            {
                $section4_tag = 0;
                $section4_min_phase_orb = $v1['planets'][1]['phase']['1-3']['phase_orb'];
            }
            if (isset($v1['planets'][1]['phase']['1-2']) && $v1['planets'][1]['phase']['1-2']['phase_orb'] < $section4_min_phase_orb)
            {
                $section4_tag = 1;
                $section4_min_phase_orb = $v1['planets'][1]['phase']['1-2']['phase_orb'];
            }
            if (isset($v1['planets'][1]['phase']['1-4']) && $v1['planets'][1]['phase']['1-4']['phase_orb'] < $section4_min_phase_orb)
            {
                $section4_tag = 2;
                $section4_min_phase_orb = $v1['planets'][1]['phase']['1-4']['phase_orb'];
            }
            if (isset($v1['planets'][1]['phase']['1-5']) && $v1['planets'][1]['phase']['1-5']['phase_orb'] < $section4_min_phase_orb)
            {
                $section4_tag = 3;
                $section4_min_phase_orb = $v1['planets'][1]['phase']['1-5']['phase_orb'];
            }
            if (isset($v1['planets'][1]['phase']['1-0']) && $v1['planets'][1]['phase']['1-0']['phase_orb'] < $section4_min_phase_orb)
            {
                $section4_tag = 4;
            }
            $tag4Tmp[$section4_tag]++;
            $time = strtotime('+1month', $time);
        }
        $maxSection = array_search(max($tag4Tmp), $tag4Tmp, true);
        $tags['tpoics'][3]['text'][] = 10030000 + $maxSection;

        //主题 5、对方是否有新桃花
        //	对方个人月次限：取 12 个月（以下订单的当前月开始计 12 个月）
        //①月亮1-12宫，（与金星和谐/刑克相位）（词条总数12*1条）
        //②月亮 1/5/7/11，（与木星产生任意相位）（词条总数4*1条）
        //③不满足条件词条（词条总数1条）
        //调用逻辑：
        //  1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //  2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //  3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞条件③
        //  4、词条调用：A逻辑最终输出仅 1 个词条，首取满足①或②的条件，若不属于条件①-②，则取条件③词条
        //  5、依次排查 12 个月的相位，取用满足条件最多的词条；
        //  若①②同时存在，取相位最紧密
        //  若条件③词条最多情况，则取次多的条件，且需满足相位持续＞3个月，至多取 2 条；
        //  若不满足则取条件③
        //固定语示例：在接下来一年，+词条
        //  同时+词条（有第二条词条则显示）
        $section5_tagA = 3;
        $section5_min_phase_orbA = 10;
        $time = $this->startTime;
        $moonHouse = 0;
        foreach ($progressions[1] as $k1 => $v1)
        {
            // 与金星产生任意相位
            if ($this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 90, 120, 180])
                && $v1['planets'][1]['phase']['1-3']['phase_orb'] < $section5_min_phase_orbA)
            {
                $moonHouse = $v1['planets'][1]['in_house_id'];
                $section5_tagA = 1;
                $section5_min_phase_orbA = $v1['planets'][1]['phase']['1-3']['phase_orb'];
            }
            // 月亮 1/5/7/11，（与木星产生任意相位）
            if ($this->isPlanetInHouse($v1['planets'], 1, [1, 5, 7, 11])
                && $this->isPlanetPhasePlanet($v1['planets'], 1, 5, [0, 60, 90, 120, 180])
                && $v1['planets'][1]['phase']['1-5']['phase_orb'] < $section5_min_phase_orbA)
            {
                $moonHouse = $v1['planets'][1]['in_house_id'];
                $section5_tagA = 2;
                $section5_min_phase_orbA = $v1['planets'][1]['phase']['1-5']['phase_orb'];
            }
            $time = strtotime('+1 month', $time);
        }
        switch ($section5_tagA)
        {
            case 1:
                $tags['tpoics'][4]['text']['A'][] = 1004000000 + $moonHouse - 1;
                break;
            case 2:
                $housesKey = [1 => 0, 5 => 1, 7 => 2, 11 => 3];
                $tags['tpoics'][4]['text']['A'][] = 1004000100 + $housesKey[$moonHouse];
                break;
            default:
                $tags['tpoics'][4]['text']['A'][] = 10040002;
                break;
        }

        //	B、对方个人月三限：（取下单当月起始的 12 个月）
        //①月亮在1/5/7/8/11宫，（与太阳/金星形成0/60/120度）（词条总数5*1条）
        //②月亮1-12宫，与金星和谐/刑克相位（词条总数12条）
        //③月亮1/5/7/11，与木星产生任意相位（词条总数1条）
        //④不满足条件词条（词条总数1条）
        //调用逻辑：
        //  1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 7 号为推运起始时间
        //  2、三限盘取用：以下单当月计 12 个月为一年，每月从7、14、21日三个盘中取1 个最紧密相位。
        //  3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞条件③
        //  4、词条调用：B 逻辑最终输出多条，首取满足①-③条件的月份，一个月中仅调用1 条，满足条件的月份即可调用，不满足的月份则不调用；
        //  5、若条件同时存在，取用优先级：条件①＞条件②＞条件③＞条件④
        //  6、依次排查 12 个月的相位，若有多个月份满足条件一致，则只取 1 条；若12 个月都不满足条件①-③，则取条件④词条，即 12 个月总共仅 1 条；
        //  7、若连续几个月均满足①-③的同一个条件，则多个月份仅调用 1 个对应词条，不重复调用，并在前面标注满足的年份月份；
        //固定语示例：
        //具体来看，在 XX 年XX 月的时候+词条
        $time = $this->startTime;
        $tag5bTmp = [];
        foreach ($thirdprogressed[1] as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (!isset($tag5bTmp[$date]))
            {
                $tag5bTmp[$date] = [
                    'date' => $date,
                    'house' => $v1MoonHouse,
                    'phase_orb' => 50,
                    'tag' => 4,
                ];
            }
            // 月亮在1/5/7/8/11宫，（与太阳/金星形成0/60/120度）（词条总数5*1条）
            if ($this->isPlanetInHouse($v1['planets'], 1, [1, 5, 7, 8, 11]))
            {
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 0, [0, 60, 120])
                    && ($v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag5bTmp[$date]['phase_orb']))
                {
                    $tag5bTmp[$date]['house'] = $v1MoonHouse;
                    $tag5bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-0']['phase_orb'];
                    $tag5bTmp[$date]['tag'] = 1;
                }
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 120])
                    && ($v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag5bTmp[$date]['phase_orb']))
                {
                    $tag5bTmp[$date]['house'] = $v1MoonHouse;
                    $tag5bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-3']['phase_orb'];
                    $tag5bTmp[$date]['tag'] = 1;
                }
            }
            // 与金星产生任意相位
            if ($this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 90, 120, 180])
                && ($v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag5bTmp[$date]['phase_orb']))
            {
                $tag5bTmp[$date]['house'] = $v1MoonHouse;
                $tag5bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-3']['phase_orb'];
                $tag5bTmp[$date]['tag'] = 2;
            }
            // 月亮 1/5/7/11，（与木星产生任意相位）
            if ($this->isPlanetInHouse($v1['planets'], 1, [1, 5, 7, 11])
                && $this->isPlanetPhasePlanet($v1['planets'], 1, 5, [0, 60, 90, 120, 180])
                && $v1['planets'][1]['phase']['1-5']['phase_orb'] < $tag5bTmp[$date]['phase_orb'])
            {
                $tag5bTmp[$date]['house'] = $v1MoonHouse;
                $tag5bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-5']['phase_orb'];
                $tag5bTmp[$date]['tag'] = 3;
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        foreach ($tag5bTmp as $d => $t5bt)
        {
            switch ($t5bt['tag'])
            {
                case 1:
                    $housesKey = [1 => 0, 5 => 1, 7 => 2, 8 => 3, 11 => 4];
                    $tags['tpoics'][4]['text']['B'][] = [
                        'date' => $d,
                        'code' => 1004010000 + $housesKey[$t5bt['house']],
                    ];
                    break;
                case 2:
                    $tags['tpoics'][4]['text']['B'][] = [
                        'date' => $d,
                        'code' => 1004010100 + $t5bt['house'] - 1,
                    ];
                    break;
                case 3:
                    $housesKey = [1 => 0, 5 => 1, 7 => 2, 11 => 3];
                    $tags['tpoics'][4]['text']['B'][] = [
                        'date' => $d,
                        'code' => 1004010200 + $housesKey[$t5bt['house']],
                    ];
                    break;
                default:
                    break;
            }
        }
        // 若12 个月都不满足条件①-③，则取条件④词条
        if (empty($tags['tpoics'][4]['text']['B']))
        {
            $tags['tpoics'][4]['text']['B'][] = ['date' => '', 'code' => 10040103];
        }

        //主题 6、怎么做才能旺桃花人缘
        //个人小限：取购买者下订单当年
        //①日/月/水/金/火/木/土 1-12宫（词条总数7*12条）
        //调用逻辑：
        //  取解锁报告月份的当前年份，满足条件即可调用词条，仅调用一条
        //  1、按报告解锁时间为推运时间，计 12 个月，取小限流年征象星，且离下个小限运结束期≥4个月
        //  2、若小限流年包含月份相同，则同时取用2 段。
        //固定语示例：在接下来一年，如果想要增强您的桃花人缘+词条
        //同时+词条（有第二条词条则显示）
        $profectionYearHouse = $profection[0]['profection']['year_house'];
        $profectionMonthHouse = $profection[0]['profection']['month_house'];

        $yearMonthDiff = $this->mod($profectionMonthHouse - $profectionYearHouse, 1, 13);
        if ($yearMonthDiff >= 6)
        {
            $tags['tpoics'][5]['text'][] = 100500000000 + $natal[0]['houses'][$profectionMonthHouse]['protect_ancient_id'] * 100 + $natal[0]['houses'][$profectionMonthHouse]['protect_ancient_inhouse_id'] - 1;
        }
        if ($yearMonthDiff <= 6)
        {
            $profectionMonthHouseNext = $this->mod($profectionMonthHouse - 1, 1, 13);
            $tags['tpoics'][5]['text'][] = 100500000000 + $natal[0]['houses'][$profectionMonthHouseNext]['protect_ancient_id'] * 100 + $natal[0]['houses'][$profectionMonthHouseNext]['protect_ancient_inhouse_id'] - 1;
        }

        return $tags;
    }

    /**
     * 已恋状态
     */
    private function getState2Data()
    {
        $tags = [
            'start_time' => $this->startTime,
            'tpoics' => [
                0 => [
                    'text' => [],
                    'level' => [],
                ],
                1 => [
                    'text' => [],
                    'level' => [],
                ],
                2 => [
                    'text' => [],
                    'level' => [],
                ],
                3 => [
                    'text' => [],
                    'level' => [],
                ],
                4 => [
                    'text' => [],
                    'level' => [],
                ],
                5 => [
                    'text' => [],
                    'level' => [],
                ],
            ],
        ];

        /**
         * 获取当前所需星盘数据
         */
        $astroData = $this->getAstroDatas([
            'natal',
            'profection',
            'firdaria',
            'thirdprogressed',
            'progressions',
            'composite_thirdprogressed',
            'composite_progressions'
        ]);
        $astroData = json_decode(json_encode($astroData, true), true);
        $natal = $astroData['natal'];
        $firdaria = $astroData['firdaria'];
        $composite_thirdprogressed = $astroData['composite_thirdprogressed'];
        $composite_progressions = $astroData['composite_progressions'];

        //主题1：感情升温的月份
        //A、法达星限（调用购买人法达星限）：
        //①若该副限行星为金/月、5R/7R、落5R/7R内、互容接纳5R/7R/57R宫内星（词条总数 1）
        //②若该副限行星被火土天海冥刑克(无互容接纳)、接纳互容火/土(非5/7R，5/7宫内星) （词条总数 1）
        //③非以上情况（词条总数 1）
        //调用逻辑：取解锁报告月份的当前年份，满足条件即可调用词条，仅调用一条，若不满足①②则取③
        //  1、解锁报告的月份的当前年，需满足解锁月离副限运结束期≥3个月
        //  2、全部按报告解锁时间为推运时间
        //词条示例：
        //对于你个人而言，今年是有利于你推进桃花感情发展的年份。在这基础影响之下：
//        $tag1A = $this->getSection1($firdaria[0], $natal[0]);
        // 主题1词条
//        $tags['tpoics'][0]['text']['A'][] = 11000000 + $tag1A;

        //C、组合次限：取1年期（以下订单的当前月开始计12 个月为 1 年）
        //①月亮在 1、4/5/7、10/ 6、8/ 3、11宫，与（太阳/金星形成0/60/120度）（词条总数 5*1）
        //②月亮在 1、4/5/7、10/ 6、8/ 3、11宫，与（太阳/金星形成90/180度）（词条总数 5*1）
        //③非以上情况+0 分（词条总数1 ）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 1 号为推运起始时间
        //2、次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：C 逻辑最终输出仅 1 个词条，首取满足条件①或②的词条，若当年都不满足，则取③的词条，仅一条。
        //5、若 12 个月份中有多个月份满足条件①或②，则取持续月份最多的条件；
        //若满足月份等同，则按照3 的优先排序取用
        $housesKey = [1 => 0, 3 => 4, 4 => 0, 5 => 1, 6 => 3, 7 => 2, 8 => 3, 10 => 2, 11 => 4];
        $time = $this->startTime;
        $tag1_B = [
            1 => ['h' => 1, 'c1' => 0, 'c2' => 0, 'c3' => 0], 3 => ['h' => 3, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            4 => ['h' => 4, 'c1' => 0, 'c2' => 0, 'c3' => 0], 5 => ['h' => 5, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            6 => ['h' => 6, 'c1' => 0, 'c2' => 0, 'c3' => 0], 7 => ['h' => 7, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            8 => ['h' => 8, 'c1' => 0, 'c2' => 0, 'c3' => 0], 10 => ['h' => 10, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            11 => ['h' => 11, 'c1' => 0, 'c2' => 0, 'c3' => 0]
        ];
        $tag1B0Num = 0;// 满足条件1的数量
        $tag1B1Num = 0;// 满足条件2的数量
        $tag1B2Num = 0;// 满足条件3的数量
        foreach ($composite_progressions as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            // 反向判断，不在2、9、12宫
            if (!$this->isPlanetInHouse($v1['planets'], 1, [2, 9, 12]))
            {
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 0, [0, 60, 120])
                    || $this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 120]))
                {
                    $tag1B0Num++;
                    $tag1_B[$v1MoonHouse]['c1']++;
                } elseif ($this->isPlanetPhasePlanet($v1['planets'], 1, 0, [90, 180])
                    || $this->isPlanetPhasePlanet($v1['planets'], 1, 3, [90, 180]))
                {
                    $tag1B1Num++;
                    $tag1_B[$v1MoonHouse]['c2']++;
                } else
                {
                    $tag1B2Num++;
                    $tag1_B[$v1MoonHouse]['c3']++;
                }
            } else
            {
                $tag1B2Num++;
            }
            $time = strtotime('+1 month', $time);
        }
        // 12个月中没有满足条件1和条件2的
        if ($tag1B2Num === 12)
        {
            $tags['tpoics'][0]['text']['B'][] = 11000202;
        } else
        {
            // 重置索引
            $tag1_B = array_merge($tag1_B);
            if ($tag1B0Num > $tag1B1Num)
            {
                $tag1_B = resort($tag1_B, 'c1', 'DESC');
                $key = 1100020000;
            } elseif ($tag1B0Num === $tag1B1Num)
            {
                $tag1_B = resort($tag1_B, 'c1', 'DESC');
                $key = 1100020000;
                $tags['tpoics'][0]['text']['B'][] = $key + $housesKey[$tag1_B[0]['h']];

                $tag1_B = resort($tag1_B, 'c2', 'DESC');
                $key = 1100020100;
            } else
            {
                $tag1_B = resort($tag1_B, 'c2', 'DESC');
                $key = 1100020100;
            }
            $tags['tpoics'][0]['text']['B'][] = $key + $housesKey[$tag1_B[0]['h']];
        }

        //B、组合三限：取 12 个月（以下订单的当前月开始计 12 个月）有图形
        //①月亮在 1、4/5/7、10/6、8/3、11宫，与太阳/金星/日金形成（0/60/120度），不与天、海、冥有 90/180相位 +5分（词条总数 5*3条，调用词条多条）
        //②月亮在 1、4/5/7、10/6、8/3、11宫，与太阳/金星/日金形成（90/180度 ），不与天、海、冥有 90/180相位+3分（词条总数 5*3条，调用词条多条）
        //③非以上情况+0 分（词条总数1 条）
        //新增标注：与太阳/金星/日金形成（0/60/120度）或（90/180度 ）的情况具体为：
        //若与日成相，且不与金成相
        //若与金成相，且不与日成相
        //若同时与日金成相，只需满足括弧内相位，不必相同
        //若同时与日金成相，相位分别为（0/60/120度）或（90/180度 ），则取相位容许度最紧密；
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 1 号为推运起始时间
        //2、组合三限盘取用：以下单当月计 12 个月为一年，每月从7、14、21日三个盘中取1 个最紧密相位。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：B 逻辑最终输出多条，首取满足①、②条件的月份，1 个月份仅调用1 条，满足条件的月份即可调用，不满足的月份则不调用；
        //5、若 12 个月全都不满足①或②，则取③的词条，即 12 个月总共仅 1 条；
        //6、若连续几个月均满足①，或②的同一个条件，则多个月份仅调用 1 个对应词条，不重复调用，并在前面标注满足的年份月份；
        $housesKey = ['1' => 0, '3' => 4, '4' => 0, '5' => 1, '6' => 3, '7' => 2, '8' => 3, '10' => 2, '11' => 4];
        $planetsKey = ['0' => 0, '3' => 1, '0,3' => 2];
        $time = $this->startTime;
        $tag1cTmp = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (empty($tag1cTmp[$date]))
            {
                $tag1cTmp[$date] = [
                    'date' => $date,
                    'house' => $v1MoonHouse,
                    'phase_id' => null,
                    'phase_e' => null,
                    'phase_orb' => null,
                ];
            }
            if (!$this->isPlanetInHouse($v1['planets'], 1, [2, 9, 12])
//                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 4, [90, 180])
//                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 6, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 7, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 8, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 9, [90, 180])
            )
            {
                $isPhaseSun = isset($v1['planets'][1]['phase']['1-0']);
                $isPhaseVenu = isset($v1['planets'][1]['phase']['1-3']);
                // 与日金同时成相
                if ($isPhaseSun && $isPhaseVenu)
                {
                    // 与太阳相位更紧密
                    if ($v1['planets'][1]['phase']['1-0']['phase_orb'] <= $v1['planets'][1]['phase']['1-3']['phase_orb'])
                    {
                        if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                        {
                            $tag1cTmp[$date] = [
                                'date' => $date,
                                'house' => $v1MoonHouse,
                                'phase_id' => '0,3',
                                'phase_e' => $v1['planets'][1]['phase']['1-0']['phase_e'],
                                'phase_orb' => $v1['planets'][1]['phase']['1-0']['phase_orb'],
                            ];
                        }
                    }// 与金星相位更紧密
                    else
                    {
                        if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                        {
                            $tag1cTmp[$date] = [
                                'date' => $date,
                                'house' => $v1MoonHouse,
                                'phase_id' => '0,3',
                                'phase_e' => $v1['planets'][1]['phase']['1-3']['phase_e'],
                                'phase_orb' => $v1['planets'][1]['phase']['1-3']['phase_orb'],
                            ];
                        }
                    }
                }// 仅与太阳成相
                elseif ($isPhaseSun && !$isPhaseVenu)
                {
                    if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                    {
                        $tag1cTmp[$date] = [
                            'date' => $date,
                            'house' => $v1MoonHouse,
                            'phase_id' => 0,
                            'phase_e' => $v1['planets'][1]['phase']['1-0']['phase_e'],
                            'phase_orb' => $v1['planets'][1]['phase']['1-0']['phase_orb'],
                        ];
                    }
                }// 仅与金星成相
                elseif (!$isPhaseSun && $isPhaseVenu)
                {
                    if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                    {
                        $tag1cTmp[$date] = [
                            'date' => $date,
                            'house' => $v1MoonHouse,
                            'phase_id' => 3,
                            'phase_e' => $v1['planets'][1]['phase']['1-3']['phase_e'],
                            'phase_orb' => $v1['planets'][1]['phase']['1-3']['phase_orb'],
                        ];
                    }
                }
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        $num = 0;
        foreach ($tag1cTmp as $d => $tct)
        {
            if (in_array($tct['phase_e'], [0, 60, 120], true))
            {
                $num++;
                $s = 5;
                $tags['tpoics'][0]['text']['C'][] = [
                    'date' => $d,
                    'code' => 110001000000 + $housesKey[$tct['house']] * 100 + $planetsKey[$tct['phase_id']],
                ];
            } elseif ($tct['phase_e'] !== null)
            {
                $num++;
                $s = 3;
                $tags['tpoics'][0]['text']['C'][] = [
                    'date' => $d,
                    'code' => 110001010000 + $housesKey[$tct['house']] * 100 + $planetsKey[$tct['phase_id']],
                ];
            } else
            {
                $s = 0;
            }
            $tags['tpoics'][0]['level'][] = $s;
        }
        // 12个月前两个条件都不满足，则取条件3，仅出一个词条
        if ($num === 0)
        {
            $tags['tpoics'][0]['text']['C'][] = ['date' => '', 'code' => 11000102];
        }

        //主题2：感情受阻的月份
        //B、组合次限：取1年期（以下订单的当前月开始计12 个月为 1 年）
        //①月亮在 2/1、5、9/6、10/7/4、8/12宫，与（火土/火星/土星）形成任意相位，不与日金有相位（词条总数 6*1）
        //②月亮在 2/1、5、9/6、10/7/4、8/12宫，与（天/海/冥）形成任意相位，不与日金有相位分（词条总数6*1）
        //③非以上情况+0 分（调用词条1 条）
        //调用逻辑： 1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 1 号为推运起始时间
        //2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个组合次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：B 逻辑最终输出仅 1 个词条；首取满足条件①或②的词条，若当年都不满足①或②，则取③的词条，仅1条。
        //5、若 12 个月份中有多个满足条件①②存在，则取持续月份最多的词条；
        //若满足月份等同，则按照3 的优先排序取用
        $time = $this->startTime;
        $tag2A = [
            ['key' => 0, 'num' => 0, 'data' => []],
            ['key' => 1, 'num' => 0, 'data' => []],
            ['key' => 2, 'num' => 0, 'data' => []],
        ];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (!$this->isPlanetInHouse($v1['planets'], 1, [3, 11])
                && !isset($v1['planets'][1]['phase']['1-0'])
                && !isset($v1['planets'][1]['phase']['1-3']))
            {
                if (isset($v1['planets'][1]['phase']['1-4'])
                    || isset($v1['planets'][1]['phase']['1-6']))
                {
                    $tag2A[0]['num']++;
                    $tag2A[0]['data'][] = $v1MoonHouse;
                } elseif (isset($v1['planets'][1]['phase']['1-7'])
                    || isset($v1['planets'][1]['phase']['1-8'])
                    || isset($v1['planets'][1]['phase']['1-9']))
                {
                    $tag2A[1]['num']++;
                    $tag2A[1]['data'][] = $v1MoonHouse;
                } else
                {
                    $tag2A[2]['num']++;
                    $tag2A[2]['data'][] = $v1MoonHouse;
                }
            } else
            {
                $tag2A[2]['num']++;
                $tag2A[2]['data'][] = $v1MoonHouse;
            }
            $time = strtotime('+1 month', $time);
        }
        if ($tag2A[2]['num'] === 12)
        {
            $tags['tpoics'][1]['text']['A'][] = 11010002;
        } else
        {
            unset($tag2A[2]);
            $tag2A = resort($tag2A, 'num', 'DESC');
            $tag2A0Num = array_count_values($tag2A[0]['data']);
            // 若条件1与条件2次数一样
            if ($tag2A[0]['num'] === $tag2A[1]['num'])
            {
                $hs = array_merge($tag2A[0]['data'], $tag2A[1]['data']);
                $hs_count_value = array_count_values($hs);
                // 查询出现最多次的宫位id
                $hs_more_value = key($hs_count_value);
                $tag2A1Num = array_count_values($tag2A[1]['data']);
                if (isset($tag2A1Num[$hs_more_value]) && $tag2A1Num[$hs_more_value] > $tag2A0Num[$hs_more_value])
                {
                    $tag2A[0] = $tag2A[1];
                    $tag2A0Num = $tag2A1Num;
                }
            }
            $housesKey = ['1' => 1, '2' => 0, '4' => 4, '5' => 1, '6' => 2, '7' => 3, '8' => 4, '9' => 1, '10' => 2, '12' => 5];
            $tags['tpoics'][1]['text']['A'][] = 1101000000 + $tag2A[0]['key'] * 100 + $housesKey[key($tag2A0Num)];
        }

        //B、组合三限：取 12 个月（以下订单的当前月开始计 12 个月）有图形
        //①月亮在 2/1、5、9/6、10/7/4、8/12宫，与（火星/土星）形成任意相位，不与日金有相位（词条总数6*1条）+3分
        //②月亮在 2/1、5、9/6、10/7/4、8/12宫，与（天/海/冥）形成任意相位，不与日金有相位（词条总数6*1条）+5 分
        //③非以上情况+0 分（词条总数1 ）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 1 号为推运起始时间
        //2、组合三限盘取用：以下单当月计 12 个月为一年，每月从7、14、21日三个盘中取1 个最紧密相位。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：A 逻辑最终输出多条，首取满足①②条件的月份，1 个月份仅调用1 条，满足条件的月份即可调用，不满足则不调用；
        //5、若 12 个月都不满足①或②，则取③的词条，仅 1 条；
        //6、若连续几个月均满足①，或②的同一条件，则直接仅调用 1 个对应词条，不重复调用，在前面标注满足的月份；
        $time = $this->startTime;
        $tag2bTmp = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            $tag2bTmp[$date] = [
                'date' => $date,
                'house' => $v1MoonHouse,
                'phase_id' => null,
                'phase_e' => null,
                'phase_orb' => null,
            ];
            // 不与日金成相
            if (!$this->isPlanetInHouse($v1['planets'], 1, [3])
                && (!isset($v1['planets'][1]['phase']['1-0'])
                    || $this->checkMordenPhase($v1['planets'][1]['phase']['1-0']['phase_e'], $v1['planets'][1]['phase']['1-0']['phase_orb']))
                && (!isset($v1['planets'][1]['phase']['1-3'])
                    || $this->checkMordenPhase($v1['planets'][1]['phase']['1-3']['phase_e'], $v1['planets'][1]['phase']['1-3']['phase_orb'])))
            {
                if (isset($v1['planets'][1]['phase']['1-4'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-4']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 4;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-4']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-4']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-6'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-6']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 6;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-6']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-6']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-7'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-7']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 7;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-7']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-7']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-8'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-8']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 8;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-8']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-8']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-9'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-9']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 9;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-9']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-9']['phase_orb'];
                }
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        $nullNum = 0;
        $housesKey = ['1' => 1, '2' => 0, '4' => 4, '5' => 1, '6' => 2, '7' => 3, '8' => 4, '9' => 1, '10' => 2, '11' => 1, '12' => 5];
        foreach ($tag2bTmp as $d => $t2bt)
        {
            $s = 0;
            if ($t2bt['phase_id'] !== null && (empty($tmp) || $t2bt['phase_orb'] < $tmp['phase_orb']))
            {
                $tmp = $t2bt;
            }
            if (in_array($t2bt['phase_id'], [4, 6], true))
            {
                $s = 3;
                $tags['tpoics'][1]['text']['B'][] = [
                    'date' => $d,
                    'code' => 1101020000 + $housesKey[$t2bt['house']],
                ];
            } elseif (in_array($t2bt['phase_id'], [7, 8, 9], true))
            {
                $s = 5;
                $tags['tpoics'][1]['text']['B'][] = [
                    'date' => $d,
                    'code' => 1101020100 + $housesKey[$t2bt['house']],
                ];
            } else
            {
                $nullNum++;
            }
            $tags['tpoics'][1]['level'][] = $s;
        }
        if ($nullNum === 12)
        {
            $tags['tpoics'][1]['text']['B'][] = [
                'date' => '',
                'code' => 11010202
            ];
        }

        //C、若主题4的 C、主题5的 B 出现相同月份，则单出1 个词条
        if (!empty($tags['tpoics'][0]['text']['C']) && !empty($tags['tpoics'][1]['text']['B']))
        {
            $sameMonth = [];
            foreach ($tags['tpoics'][0]['text']['C'] as $k1 => $t2a)
            {
                foreach ($tags['tpoics'][1]['text']['B'] as $k2 => $t2b)
                {
                    if ($t2a['date'] === $t2b['date'])
                    {
                        $sameMonth[] = $t2a['date'];
                    }
                }
            }
            if (!empty($sameMonth))
            {
                $tags['tpoics'][1]['text']['C'][] = [
                    'date_list' => $sameMonth,
                    'code' => 110101
                ];
            } else
            {
                $tags['tpoics'][1]['text']['C'] = [];
            }
        } else
        {
            $tags['tpoics'][1]['text']['C'] = [];
        }

        //主题3：感情中潜在的挑战
        //组合次限：取 12 个月（以下订单的当前月开始计 12 个月）
        //①月亮落1-12宫，与日、金/水、木（90/180）、与火、土/天、海、冥的（0/90/180）（词条总数 12*4条）
        //②月亮在1-12宫（词条总数12条）
        //③月亮空相（词条总数1条）
        //调用逻辑：
        //1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 1 号为推运起始时间
        //2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个组合次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相，且持续时间＞4 个月
        //4、词条调用：该逻辑最终输出仅 1 个词条，首看是否满足条件③，若不满足③条件，则取①条件，若都不满足③或①的条件，则取②。
        //5、若 12 个月份中有多个月份满足条件①或②，则取持续月份最多的条件；
        //若满足月份等同，则按照3 的优先排序取用
        $time = $this->startTime;
        $tag3 = [];
        $nullNum = 0;
        $housesArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (empty($v1['planets'][1]['phase']))
            {
                $nullNum++;
            } else
            {
                foreach ($v1['planets'][1]['phase'] as $k2 => $phase)
                {
                    if ($phase['id'] > 9)
                    {
                        unset($v1['planets'][1]['phase'][$k2]);
                    }
                }
                $housesArr[$v1MoonHouse]++;
                if (count($v1['planets'][1]['phase']) > 0)
                {
                    $v1MoonPhase = resort(array_values($v1['planets'][1]['phase']), 'phase_orb', 'ASC');
                    $tag3[0][] = [
                        'date' => $date,
                        'house' => $v1MoonHouse,
                        'phase_id' => $v1MoonPhase[0]['id'],
                    ];
                } else
                {
                    $nullNum++;
                    $tag3[1][] = [
                        'date' => $date,
                        'house' => $v1MoonHouse,
                        'phase_id' => null,
                    ];
                }
            }
            $time = strtotime('+1 month', $time);
        }
        // 若12个月均为空相
        if ($nullNum === 12)
        {
            $tags['tpoics'][2]['text'][] = 11020002;
        } else
        {
            if (isset($tag3[0], $tag3[1]) && count($tag3[0]) >= count($tag3[1]))
            {
                $tag3[0] = $tag3[1];
            }
            // 获取持续最多的宫位
            $maxHouse = array_search(max($housesArr), $housesArr, true);
            $phaseNum = 0;
            $phaseArray = [];
            if (isset($tag3[0]) && !empty($tag3[0]))
            {
                foreach ($tag3[0] as $k1 => $v1)
                {
                    if ($v1['house'] === $maxHouse && $v1['phase_id'] !== null)
                    {
                        $phaseNum++;
                        $phaseArray[] = $v1['phase_id'];
                    }
                }
            }
            if ($phaseNum)
            {
                $morePhasePlanets = array_count_values($phaseArray);
                $morePhasePlanet = array_search(max($morePhasePlanets), $morePhasePlanets, true);
                $phasePlanetArray = [0 => 0, 2 => 1, 3 => 0, 4 => 2, 5 => 1, 6 => 2, 7 => 3, 8 => 3, 9 => 3];
                $tags['tpoics'][2]['text'][] = 110200000000 + ($maxHouse - 1) * 100 + $phasePlanetArray[$morePhasePlanet];
            } else
            {
                $tags['tpoics'][2]['text'][] = 1102000100 + ($maxHouse - 1);
            }
        }

        //主题4：移情别恋的可能性
        //组合三限：取 12 个月（以下订单的当前月开始计 12 个月）
        //①
        //  当月亮与金海形成（90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
        //  当月亮与/金冥形成（90/180 度）,且其中任意星体在在1、5、7、8、11、12宫
        //  当月亮与海王形成（0/90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
        //  当月亮与冥王形成（0/90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
        //②月亮空相（词条总数1条）
        //③不满足以上条件（词条总数1条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 1 号为推运起始时间
        //2、组合三限盘取用：以下单当月计 12 个月为一年，每月从7、14、21日三个盘中取1 个最紧密相位。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：该逻辑最终输出多条，取满足条件的月份，1 个月中仅调用相位最紧密的 1 个词条，不满足则不调用。
        //2、首看是否满足条件②，若不满足则看是否满足①条件，若12 个月都不满足②、①的条件则取③。
        //3、若连续几个月都满足②或①的条件，则直接仅调用 1 个对应词条，不重复调用，在前面标注满足的月份；
        $time = $this->startTime;
        $tag4Tmp = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (!isset($tag4Tmp[$date]))
            {
                $tag4Tmp[$date] = [
                    'date' => $date,
                    'tag' => 2,
                    'phase_orb' => null,
                    'code' => 11030002,
                ];
            }
            if (!empty($v1['planets'][1]['phase']))
            {
                // 去除十大行星以外的相位
                foreach ($v1['planets'][1]['phase'] as $k2 => $v2)
                {
                    if ($v2['id'] > 9) unset($v1['planets'][1]['phase'][$k2]);
                }
            }
            // ②月亮空相
            if (empty($v1['planets'][1]['phase']))
            {
                $tag4Tmp[$date] = [
                    'date' => $date,
                    'tag' => 1,
                    'phase_orb' => null,
                    'code' => 11030001,
                ];
            } else
            {
                //①
                //  当月亮与金海形成（90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
                //  当月亮与金冥形成（90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
                //  当月亮与海王形成（0/90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
                //  当月亮与冥王形成（0/90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
                $isVenuInHouse = false;
                if ($this->isPlanetInHouse($v1['planets'], 3, [1, 5, 7, 8, 11, 12]))
                {
                    $isVenuInHouse = true;
                }
                $isNeptInHouse = false;
                if ($this->isPlanetInHouse($v1['planets'], 8, [1, 5, 7, 8, 11, 12]))
                {
                    $isNeptInHouse = true;
                }
                $isPlutInHouse = false;
                if ($this->isPlanetInHouse($v1['planets'], 9, [1, 5, 7, 8, 11, 12]))
                {
                    $isPlutInHouse = true;
                }
                // 当月亮与金海形成（90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 8, [90, 180])
                    && $this->isPlanetPhasePlanet($v1['planets'], 1, 3, [90, 180])
                    && (in_array($v1MoonHouse, [1, 5, 7, 8, 11, 12], false) || $isVenuInHouse || $isNeptInHouse)
                    && ($tag4Tmp[$date]['tag'] === 2 || $v1['planets'][1]['phase']['1-8']['phase_orb'] < $tag4Tmp[$date]['phase_orb'])
                )
                {
                    $tag4Tmp[$date]['tag'] = 0;
                    $tag4Tmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-8']['phase_orb'];
                }
                // 当月亮与金冥形成（90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 9, [90, 180])
                    && $this->isPlanetPhasePlanet($v1['planets'], 1, 3, [90, 180])
                    && (in_array($v1MoonHouse, [1, 5, 7, 8, 11, 12], false) || $isVenuInHouse || $isPlutInHouse)
                    && ($tag4Tmp[$date]['tag'] === 2 || $v1['planets'][1]['phase']['1-9']['phase_orb'] < $tag4Tmp[$date]['phase_orb'])
                )
                {
                    $tag4Tmp[$date]['tag'] = 0;
                    $tag4Tmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-9']['phase_orb'];
                }
                //  当月亮与海王形成（0/90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 8, [0, 90, 180])
                    && (in_array($v1MoonHouse, [1, 5, 7, 8, 11, 12], false) || $isNeptInHouse)
                    && ($tag4Tmp[$date]['tag'] === 2 || $v1['planets'][1]['phase']['1-8']['phase_orb'] < $tag4Tmp[$date]['phase_orb'])
                )
                {
                    $tag4Tmp[$date]['tag'] = 0;
                    $tag4Tmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-8']['phase_orb'];
                }
                //  当月亮与冥王形成（0/90/180 度）, 且其中任意星体在在1、5、7、8、11、12宫
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 9, [0, 90, 180])
                    && (in_array($v1MoonHouse, [1, 5, 7, 8, 11, 12], false) || $isNeptInHouse)
                    && ($tag4Tmp[$date]['tag'] === 2 || $v1['planets'][1]['phase']['1-9']['phase_orb'] < $tag4Tmp[$date]['phase_orb'])
                )
                {
                    $tag4Tmp[$date]['tag'] = 0;
                    $tag4Tmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-9']['phase_orb'];
                }
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        foreach ($tag4Tmp as $t4)
        {
            if ($t4['tag'] !== 2)
            {
                $tags['tpoics'][3]['text'][] = [
                    'date' => $t4['date'],
//                    'tag' => $t4['tag'],
                    'code' => $t4['code'],
                ];
            }
        }
        if (empty($tags['tpoics'][3]['text']))
        {
            $tags['tpoics'][3]['text'][] = [
                'date' => '',
                'code' => 11030002,
            ];
        }

        //主题5：步入婚姻的机会
        //A、法达星限：（调用2 个人的法达星限）
        //①若该副限行星为7R、落7R内、互容接纳7R宫内星（词条总数1条）
        //②若该副限行星与7R主星、7R 内行星（除天海冥）有任意相位（词条总数1条）
        //③其它情况（词条总数1条）
        //逻辑调用：1、推运时间：按报告解锁时间
        //2、副限取用：需满足解锁月离副限运结束期≥4个月，若不满足则取下一个副限行星
        //3、词条调用：A 逻辑最终输出仅1 个词条，若不满足①②则取③
        $firdariaSubLuck1 = $firdaria[0]['firdaria']['sub_luck'];
        $house7Protect1 = $natal[0]['houses'][7]['protect_ancient_id'];
        $tag5A1 = 2;
        if ($firdariaSubLuck1 === $house7Protect1
            || $natal[0]['planets'][$firdariaSubLuck1]['in_house_id'] === 7)
        {
            $tag5A1 = 0;
        }
        if ($tag5A1 === 2 && !empty($natal[0]['houses'][7]['in_house_area_planet_info']))
        {
            $firdariaSubLuck1Charas = $this->getPlanetReceptOrMutualReceptData($firdariaSubLuck1, $natal[0]['characteristic']);
            // 互容接纳7宫宫内星
            foreach ($natal[0]['houses'][7]['in_house_area_planet_info'] as $pls7)
            {
                if ($tag5A1 !== 0 && in_array($pls7['id'], $firdariaSubLuck1Charas, false))
                {
                    $tag5A1 = 0;
                }
            }
            if ($tag5A1 !== 0)
            {
                // ②若该副限行星与7R主星、7R 内行星（除天海冥）有任意相位（词条总数1条）只要与7宫内非天海冥有相位就成立
                $fPH7 = $firdariaSubLuck1 . '-' . $house7Protect1;
                if (isset($natal[0]['planets'][$firdariaSubLuck1]['phase'][$fPH7]))
                {
                    $tag5A1 = 1;
                }
                if ($tag5A1 > 1)
                {
                    foreach ($natal[0]['houses'][7]['in_house_area_planet_info'] as $pls7)
                    {
                        $fPH7P = $firdariaSubLuck1 . '-' . $pls7['id'];
                        if ($tag5A1 !== 1 && $pls7['id'] < 7 && isset($natal[0]['planets'][$firdariaSubLuck1]['phase'][$fPH7P]))
                        {
                            $tag5A1 = 1;
                        }
                    }
                }
            }
        }
        $tags['tpoics'][4]['text']['A'][] = 11040000 + $tag5A1;


        $firdariaSubLuck2 = $firdaria[1]['firdaria']['sub_luck'];
        $house7Protect2 = $natal[1]['houses'][7]['protect_ancient_id'];
        $tag5A2 = 2;
        if ($firdariaSubLuck2 === $house7Protect2
            || $natal[1]['planets'][$firdariaSubLuck2]['in_house_id'] === 7)
        {
            $tag5A2 = 0;
        }
        if ($tag5A2 === 2 && !empty($natal[1]['houses'][7]['in_house_area_planet_info']))
        {
            $firdariaSubLuck2Charas = $this->getPlanetReceptOrMutualReceptData($firdariaSubLuck2, $natal[1]['characteristic']);
            // 互容接纳7宫宫内星
            foreach ($natal[1]['houses'][7]['in_house_area_planet_info'] as $pls7)
            {
                if ($tag5A2 !== 0 && in_array($pls7['id'], $firdariaSubLuck2Charas, false))
                {
                    $tag5A2 = 0;
                }
            }
            if ($tag5A2 !== 0)
            {
                // ②若该副限行星与7R主星、7R 内行星（除天海冥）有任意相位（词条总数1条）只要与7宫内非天海冥有相位就成立
                $fPH7 = $firdariaSubLuck2 . '-' . $house7Protect2;
                if (isset($natal[1]['planets'][$firdariaSubLuck2]['phase'][$fPH7]))
                {
                    $tag5A2 = 1;
                }
                if ($tag5A2 > 1)
                {
                    foreach ($natal[1]['houses'][7]['in_house_area_planet_info'] as $pls7)
                    {
                        $fPH7P = $firdariaSubLuck2 . '-' . $pls7['id'];
                        if ($tag5A2 !== 1 && $pls7['id'] < 7 && isset($natal[1]['planets'][$firdariaSubLuck2]['phase'][$fPH7P]))
                        {
                            $tag5A2 = 1;
                        }
                    }
                }
            }
        }
        $tags['tpoics'][4]['text']['A'][] = 11040000 + $tag5A2;

        //B、组合次限：（以下订单的当前月开始计12 个月）
        // ①月亮与日金/金，形成 0/60/120度，且其中任意星体在1、3、4、5、7、9、10、11 宫；或者 月亮与 7R 形成任意相位，且其中任意星体在1、3、4、5、7、9、10、11 宫；
        // ②（月亮与日金/金，形成 0/60/120度，且其中任意星体在1、3、4、5、7、9、10、11 宫），且其中月亮、金星有水、木/火、土/天、海、冥刑克相位； 或者 （月亮与 7R 形成任意相位，且其中任意星体在1、3、4、5、7、9、10、11 宫），其中月亮或 7R 有水、木/火、土/天、海、冥刑克相位；
        //③其它情况（词条总数1条）
        //逻辑调用：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 1 号为推运起始时间
        //2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：B 逻辑最终输出仅 1 个词条，首取满足条件①或②的词条，若当年都不满足则取③
        //5、若 12 个月份中有多个月份满足条件①或②，则取持续月份最多的条件；
        //若满足月份等同，则按照3 的优先排序取用
        $tag5bTmp = [];
        $tag5bNums = [0, 0, 0];
        $time = $this->startTime;
        foreach ($composite_progressions as $k1 => $v1)
        {
            $t1 = 2;
            $t2 = null;
            $minOrb = 20;
            // 古典7宫主
            $house7Protect = $v1['houses'][7]['protect_ancient_id'];
            // 月亮与金星有任意相位
            if ($this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 120])
                && ($this->isPlanetInHouse($v1['planets'], 1, [1, 3, 4, 5, 7, 9, 10, 11])
                    || $this->isPlanetInHouse($v1['planets'], 3, [1, 3, 4, 5, 7, 9, 10, 11])))
            {
                $tag5bPs = [2, 4, 5, 6, 7, 8, 9];
                $st = [2 => 0, 4 => 1, 5 => 0, 6 => 1, 7 => 2, 8 => 2, 9 => 2];
                foreach ($tag5bPs as $p)
                {
                    $pPhaseMoon = $p . '-1';
                    $pPhaseVenu = $p . '-3';
                    if ($this->isPlanetPhasePlanet($v1['planets'], $p, 1, [90, 180])
                        && $v1['planets'][$p]['phase'][$pPhaseMoon]['phase_orb'] < $minOrb)
                    {
                        $t2 = $st[$p];
                        $minOrb = $v1['planets'][$p]['phase'][$pPhaseMoon]['phase_orb'];
                    }
                    if ($this->isPlanetPhasePlanet($v1['planets'], $p, 3, [90, 180])
                        && $v1['planets'][$p]['phase'][$pPhaseVenu]['phase_orb'] < $minOrb)
                    {
                        $t2 = $st[$p];
                        $minOrb = $v1['planets'][$p]['phase'][$pPhaseVenu]['phase_orb'];
                    }
                }
                // 且二者之一与（水、木） / （火、土） / （天、海、冥）有刑克相位
                if ($t2 === null)
                {
                    $t1 = 0;
                } elseif ($t2 >= 0)
                {
                    $t1 = 1;
                }
            } elseif ($this->isPlanetPhasePlanet($v1['planets'], 1, $house7Protect, [0, 60, 90, 120, 180])
                && ($this->isPlanetInHouse($v1['planets'], 1, [1, 3, 4, 5, 7, 9, 10, 11])
                    || $this->isPlanetInHouse($v1['planets'], $house7Protect, [1, 3, 4, 5, 7, 9, 10, 11])))
            {
                $tag5bPs = [2, 4, 5, 6, 7, 8, 9];
                $st = [2 => 0, 4 => 1, 5 => 0, 6 => 1, 7 => 2, 8 => 2, 9 => 2];
                foreach ($tag5bPs as $p)
                {
                    $pPhaseMoon = $p . '-1';
                    $pPhaseVenu = $p . '-' . $house7Protect;
                    if ($this->isPlanetPhasePlanet($v1['planets'], $p, 1, [90, 180])
                        && $v1['planets'][$p]['phase'][$pPhaseMoon]['phase_orb'] < $minOrb)
                    {
                        $t2 = $st[$p];
                        $minOrb = $v1['planets'][$p]['phase'][$pPhaseMoon]['phase_orb'];
                    }
                    if ($this->isPlanetPhasePlanet($v1['planets'], $p, $house7Protect, [90, 180])
                        && $v1['planets'][$p]['phase'][$pPhaseVenu]['phase_orb'] < $minOrb)
                    {
                        $t2 = $st[$p];
                        $minOrb = $v1['planets'][$p]['phase'][$pPhaseVenu]['phase_orb'];
                    }
                }
                // 且二者之一与（水、木） / （火、土） / （天、海、冥）有刑克相位
                if ($t2 === null)
                {
                    $t1 = 0;
                } elseif ($t2 >= 0)
                {
                    $t1 = 1;
                }
            }
            $tag5bNums[$t1]++;
            $code = $t1 === 1 ? (1104010100 + $t2) : 11040100 + $t1;
            if ($t1 < 2)
            {
                $tag5bTmp[] = $code;
            }
            // 每个月有1个盘
            $time = strtotime('+1 month', $time);
        }
        $max = max($tag5bNums);
        $maxKey = array_search($max, $tag5bNums, false);
        if ($maxKey === 2 && $max === 12)
        {
            $tags['tpoics'][4]['text']['B'][] = 11040102;
        } else
        {
            $acv = array_count_values($tag5bTmp);
            $tags['tpoics'][4]['text']['B'][] = array_search(max($acv), $acv, false);
        }

        //主题6：关系发展建议
        //组合次限：（以下订单的当前月开始计年）
        //①月亮落1-12宫，（词条总数12条）
        //②月亮与日/金/水/木/火/土/天/海/冥任意相位（词条总数1*9条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 1 号为推运起始时间
        //2、次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：该逻辑最终输出仅 1 个词条，首取时间最长的，且＞4 个月的词条；若月份相同时，同时满足①②，则优先取②条件对应词条；不满足条件②，再取条件①
        $time = $this->startTime;
        $tag6 = [];
        $housesArr = [];// 月亮落宫数组
        foreach ($composite_progressions as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            // 月亮落宫位id
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];
            $housesArr[] = $v1MoonHouse;
            // 月亮有相位
            if (!empty($v1['planets'][1]['phase']))
            {
                $phase = [];
                foreach ($v1['planets'][1]['phase'] as $k2 => $v2)
                {
                    if ($v2['id'] > 9) continue;
                    if (empty($phase) || $v2['phase_orb'] < $phase['phase_orb'])
                    {
                        $phase = [
                            'date' => $date,
                            'time' => $time,
                            'moon_house' => $v1MoonHouse,
                            'id' => $v2['id'],
                            'phase_e' => $v2['phase_e'],
                            'phase_orb' => $v2['phase_orb'],
                        ];

                    }
                }
                if (!empty($phase))
                {
                    $tag6[] = $phase;
                }
            }
            $time = strtotime('+1 month', $time);
        }
        // 月亮一直空相
        if (empty($tag6))
        {
            $hcv = array_count_values($housesArr);
            $h = array_search(max($hcv), $hcv, false);
            // + 月亮落宫id
            $tags['tpoics'][5]['text'][] = 1105000000 + $h - 1;
        } else
        {
            $citiao = [];
            foreach ($tag6 as $k1 => $v1)
            {
                if (empty($citiao) || $v1['phase_orb'] < $citiao['phase_orb'])
                {
                    $citiao = $v1;
                }
            }
            $citiao['id'] = $citiao['id'] === 0 ? $citiao['id'] : $citiao['id'] - 1;
            $tags['tpoics'][5]['text'][] = 1105000100 + $citiao['id'];
        }

        return $tags;
    }

    /**
     * 分手状态
     */
    private function getState3Data()
    {
        $tags = [
            'start_time' => $this->startTime,
            'tpoics' => [
                0 => [
                    'text' => [],
                    'level' => [],
                ],
                1 => [
                    'text' => [],
                    'level' => [],
                ],
                2 => [
                    'text' => [],
                    'level' => [],
                ],
                3 => [
                    'text' => [],
                    'level' => [],
                ],
                4 => [
                    'text' => [],
                    'level' => [],
                ],
                5 => [
                    'text' => [],
                    'level' => [],
                ],
            ],
        ];

        /**
         * 获取当前所需星盘数据
         */
        $astroData = $this->getAstroDatas([
            'natal',
            'profection',
            'firdaria',
            'thirdprogressed',
            'progressions',
            'composite_thirdprogressed',
            'composite_progressions'
        ]);
        $astroData = json_decode(json_encode($astroData, true), true);
        $natal = $astroData['natal'];
        $profection = $astroData['profection'];
        $firdaria = $astroData['firdaria'];
        $thirdprogressed = $astroData['thirdprogressed'];
        $progressions = $astroData['progressions'];
        $composite_thirdprogressed = $astroData['composite_thirdprogressed'];
        $composite_progressions = $astroData['composite_progressions'];


        //主题1、近期双方状态
        //A、你的月次限：（以下订单的当前月开始计12 个月）
        //①月亮落1-12宫（词条总数12条）
        //②月亮与金/水、木/火、土/天、海、冥任意相位（词条总数1*4条）
        //③月亮在 1-12 宫的空相（词条总数 12 条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：该逻辑最终输出仅 1 个词条，首看是否满足条件③，若不满足则取足②条件，若不满足③②的条件则取①。
        //固定语示例：
        //接下来这一年+词条
        $tag1Phasearr = [2 => 1, 3 => 0, 4 => 2, 5 => 1, 6 => 2, 7 => 3, 8 => 3, 9 => 3];
        $tag1A = [0, 0, 0];
        $tag1AMinPhase = [];// 误差最小的相位
        $tag1Ahouses = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        foreach ($progressions[0] as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫
            $tag1Ahouses[$v1MoonHouse - 1]++;
            $phaseNum = 0;
            if (!empty($v1['planets'][1]['phase']))
            {
                foreach ($v1['planets'][1]['phase'] as $k2 => $phase)
                {
                    if ($phase['id'] > 9)
                    {
                        unset($v1['planets'][1]['phase'][$k2]);
                    } elseif ($phase['id'] > 1)
                    {
                        $phaseNum++;
                        if (empty($tag1AMinPhase) || $phase['phase_orb'] < $tag1AMinPhase['phase_orb'])
                        {
                            $tag1AMinPhase = $phase;
                        }
                    }
                }
            }
            // 月亮空相
            if (empty($v1['planets'][1]['phase']))
            {
                $tag1A[2]++;
            } elseif ($phaseNum > 0)
            {
                $tag1A[1]++;
            } else
            {
                $tag1A[0]++;
            }
        }
        // 查找出现最多的
        $max = array_search(max($tag1A), $tag1A, false);
        if ($max === 0)
        {
            $key = array_search(max($tag1Ahouses), $tag1Ahouses, false);
            $tags['tpoics'][0]['text']['A'][] = 1200000000 + $key;
        } elseif ($max === 1)
        {
            $key = $tag1Phasearr[$tag1AMinPhase['id']];
            $tags['tpoics'][0]['text']['A'][] = 1200000100 + $key;
        } else
        {
            $key = array_search(max($tag1Ahouses), $tag1Ahouses, false);
            $tags['tpoics'][0]['text']['A'][] = 1200000200 + $key;
        }

        //B、对方的月次限：（以下订单的当前月开始计12 个月）
        //①月亮落1-12宫（词条总数12条）
        //②月亮与金/水木/火土/天海冥任意相位（词条总数1*4条）
        //③月亮在 1-12 宫的空相（词条总数 12 条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：该逻辑最终输出仅 1 个词条，首看是否满足条件③，若不满足则取足②条件，若不满足③②的条件则取①。固定语示例：
        //接下来这一年+词条
        $tag1B = [0, 0, 0];
        $tag1BMinPhase = [];// 误差最小的相位
        $tag1Bhouses = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        foreach ($progressions[1] as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫
            $tag1Bhouses[$v1MoonHouse - 1]++;
            $phaseNum = 0;
            if (!empty($v1['planets'][1]['phase']))
            {
                foreach ($v1['planets'][1]['phase'] as $k2 => $phase)
                {
                    if ($phase['id'] > 9)
                    {
                        unset($v1['planets'][1]['phase'][$k2]);
                    } elseif ($phase['id'] > 1)
                    {
                        $phaseNum++;
                        if (empty($tag1BMinPhase) || $phase['phase_orb'] < $tag1BMinPhase['phase_orb'])
                        {
                            $tag1BMinPhase = $phase;
                        }
                    }
                }
            }
            // 月亮空相
            if (empty($v1['planets'][1]['phase']))
            {
                $tag1B[2]++;
            } elseif ($phaseNum > 0)
            {
                $tag1B[1]++;
            } else
            {
                $tag1B[0]++;
            }
        }
        // 查找出现最多的
        $max = array_search(max($tag1B), $tag1B, false);
        if ($max === 0)
        {
            $key = array_search(max($tag1Bhouses), $tag1Bhouses, false);
            $tags['tpoics'][0]['text']['B'][] = 1200010000 + $key;
        } elseif ($max === 1)
        {
            $key = $tag1Phasearr[$tag1BMinPhase['id']];
            $tags['tpoics'][0]['text']['B'][] = 1200010100 + $key;
        } else
        {
            $key = array_search(max($tag1Bhouses), $tag1Bhouses, false);
            $tags['tpoics'][0]['text']['B'][] = 1200010200 + $key;
        }

        //主题2、近期联系的可能性
        //组合三限：（以下订单的当前月开始计12 个月）
        //①月亮与 3/水星形成任意相位,同时 月亮不与土冥合刑冲、水星不与土冥刑冲（词条总数1条）
        //②其它情况（词条总数1条）
        //调用逻辑：
        //4、词条调用：该逻辑最终输出1条，取满足条件的月份，满足条件即可调用
        //5、若 12 个月都不满足①，则取②的词条，仅 1 条；
        //6、若连续几个月均满足①的同一条件，则直接仅调用 1 个对应词条，不重复调用，在前面标注满足的月份；
        //词条示例：
        //接下来一年，在 XX 月的时候+词条
        $time = $this->startTime;
        $tag2 = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $moonPhaseHouse3Protect = '1-' . $v1['houses'][3]['protect_ancient_id'];

            if (!isset($tag2[$date]))
            {
                $tag2[$date] = 1;
            }
            if ($tag2[$date] === 1
                && (!$this->isPlanetPhasePlanet($v1['planets'], 1, 6, [0, 90, 180]))
                && (!$this->isPlanetPhasePlanet($v1['planets'], 1, 9, [0, 90, 180]))
                && (!$this->isPlanetPhasePlanet($v1['planets'], 2, 6, [90, 180]))
                && (!$this->isPlanetPhasePlanet($v1['planets'], 2, 9, [90, 180]))
                && (isset($v1['planets'][1]['phase']['1-2']) || isset($v1['planets'][1]['phase'][$moonPhaseHouse3Protect])))
            {
                $tag2[$date] = 0;
            }

            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        foreach ($tag2 as $k1 => $v1)
        {
            if ($v1 === 1) unset($tag2[$k1]);
        }
        if (empty($tag2))
        {
            $tags['tpoics'][1]['text'][] = [
                'date' => '',
                'code' => 12010001,
            ];
        } else
        {
            foreach ($tag2 as $k1 => $v1)
            {
                $tags['tpoics'][1]['text'][] = [
                    'date' => $k1,
                    'code' => 12010000,
                ];
            }
        }

        //主题3、对方是否还想你
        //组合次限：（以下订单的当前月开始计12 个月）
        //①5 宫主/宫内星，是否有与 1 宫内的行星/月亮形成相位（词条总数1条）
        //②其它情况（词条总数1条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个组合次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相，且持续时间＞4 个月
        //4、词条调用：该逻辑最终输出仅 1 个词条，首取满足①条件，若 12 个月都不满足，则取②条件
        //固定语示例：
        //接下来一年+词条
        $tag3 = 1;
        foreach ($composite_progressions as $k1 => $v1)
        {
            $house5Protect1 = $v1['houses'][5]['protect_ancient_id'];
            $natal1house5PlanetsList = array_column($v1['houses'][5]['in_house_area_planet_info'], 'id');
            $natal1house5PlanetsList[] = $house5Protect1;
            $natal1house5PlanetsList = array_unique($natal1house5PlanetsList);// 5R、5宫内行星
            foreach ($natal1house5PlanetsList as $k2 => $v2)
            {
                if (!empty($v1['planets'][$v2]['phase']))
                {
                    foreach ($v1['planets'][$v2]['phase'] as $k3 => $v3)
                    {
                        if ($v3['id'] === 1 || ($v3['id'] < 9 && $v1['planets'][$v3['id']]['in_house_id'] === 1))
                        {
                            $tag3 = 0;
                            break 3;
                        }
                    }

                }
            }
        }
        $tags['tpoics'][2]['text'][] = 12020000 + $tag3;

        //主题4、当前关系的阻碍
        //组合次限：取 12 个月（以下订单的当前月开始计 12 个月）
        //①月亮落1-12宫，与日、金/水、木（90/180）、与火、土/天、海、冥的（0/90/180）（词条总数 12*4条）
        //②月亮在1-12宫（词条总数12条）
        //③月亮空相（词条总数 1条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个组合次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相，且持续时间＞4 个月
        //4、词条调用：该逻辑最终输出仅 1 个词条，首看是否满足条件③，若不满足③条件，则取①条件，若都不满足③或①的条件，则取②。
        //5、若 12 个月份中有多个月份满足条件①或②，则取持续月份最多的条件；
        //若满足月份等同，则按照3 的优先排序取用
        //固定语示例：
        //在接下来一年+词条
        $time = $this->startTime;
        $tag4 = [[], []];
        $nullNum = 0;
        $housesArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (empty($v1['planets'][1]['phase']))
            {
                $nullNum++;
            } else
            {
                foreach ($v1['planets'][1]['phase'] as $k2 => $phase)
                {
                    if ($phase['id'] > 9)
                    {
                        unset($v1['planets'][1]['phase'][$k2]);
                    }
                }
                $housesArr[$v1MoonHouse]++;
                if (count($v1['planets'][1]['phase']) > 0)
                {
                    $v1MoonPhase = resort(array_values($v1['planets'][1]['phase']), 'phase_orb', 'ASC');
                    $tag4[0][] = [
                        'date' => $date,
                        'house' => $v1MoonHouse,
                        'phase_id' => $v1MoonPhase[0]['id'],
                    ];
                } else
                {
                    $tag4[1][] = [
                        'date' => $date,
                        'house' => $v1MoonHouse,
                        'phase_id' => null,
                    ];
                }
            }
            $time = strtotime('+1 month', $time);
        }
        // 若12个月均为空相
        if ($nullNum === 12)
        {
            $tags['tpoics'][3]['text'][] = 12030002;
        } else
        {
            if (isset($tag4[1]) && count($tag4[0]) >= count($tag4[1]))
            {
                $tag4[0] = $tag4[1];
            }
            // 获取持续最多的宫位
            $maxHouse = array_search(max($housesArr), $housesArr, true);
            $phaseNum = 0;
            $phaseArray = [];
            foreach ($tag4[0] as $k1 => $v1)
            {
                if ($v1['house'] === $maxHouse && $v1['phase_id'] !== null)
                {
                    $phaseNum++;
                    $phaseArray[] = $v1['phase_id'];
                }
            }
            if ($phaseNum)
            {
                $morePhasePlanets = array_count_values($phaseArray);
                $morePhasePlanet = array_search(max($morePhasePlanets), $morePhasePlanets, true);
                $phasePlanetArray = [0 => 0, 2 => 1, 3 => 0, 4 => 2, 5 => 1, 6 => 2, 7 => 3, 8 => 3, 9 => 3];
                $tags['tpoics'][3]['text'][] = 120300000000 + ($maxHouse - 1) * 100 + $phasePlanetArray[$morePhasePlanet];
            } else
            {
                $tags['tpoics'][3]['text'][] = 1203000100 + ($maxHouse - 1);
            }
        }

        //主题5、对方桃花人缘发展
        //	对方个人月次限：取 12 个月（以下订单的当前月开始计 12 个月）
        //①月亮1-12宫，（与金星和谐/刑克相位）（词条总数12*1条）
        //②月亮 1/5/7/11，（与木星产生任意相位）（词条总数4*1条）
        //③不满足条件词条（词条总数1条）
        //调用逻辑：
        //  1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //  2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //  3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞条件③
        //  4、词条调用：A逻辑最终输出仅 1 个词条，首取满足①或②的条件，若不属于条件①-②，则取条件③词条
        //  5、依次排查 12 个月的相位，取用满足条件最多的词条；
        //  若①②同时存在，取相位最紧密
        //  若条件③词条最多情况，则取次多的条件，且需满足相位持续＞3个月，至多取 2 条；
        //  若不满足则取条件③
        //固定语示例：在接下来一年，+词条
        //  同时+词条（有第二条词条则显示）
        $section5_tagA = 3;
        $section5_min_phase_orbA = 10;
        $time = $this->startTime;
        $moonHouse = 0;
        foreach ($progressions[1] as $k1 => $v1)
        {
            // 与金星产生任意相位
            if ($this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 90, 120, 180])
                && $v1['planets'][1]['phase']['1-3']['phase_orb'] < $section5_min_phase_orbA)
            {
                $moonHouse = $v1['planets'][1]['in_house_id'];
                $section5_tagA = 1;
                $section5_min_phase_orbA = $v1['planets'][1]['phase']['1-3']['phase_orb'];
            }
            // 月亮 1/5/7/11，（与木星产生任意相位）
            if ($this->isPlanetInHouse($v1['planets'], 1, [1, 5, 7, 11])
                && $this->isPlanetPhasePlanet($v1['planets'], 1, 5, [0, 60, 90, 120, 180])
                && $v1['planets'][1]['phase']['1-5']['phase_orb'] < $section5_min_phase_orbA)
            {
                $moonHouse = $v1['planets'][1]['in_house_id'];
                $section5_tagA = 2;
                $section5_min_phase_orbA = $v1['planets'][1]['phase']['1-5']['phase_orb'];
            }
            $time = strtotime('+1 month', $time);
        }
        switch ($section5_tagA)
        {
            case 1:
                $tags['tpoics'][4]['text']['A'][] = 1204000000 + $moonHouse - 1;
                break;
            case 2:
                $housesKey = [1 => 0, 5 => 1, 7 => 2, 11 => 3];
                $tags['tpoics'][4]['text']['A'][] = 1204000100 + $housesKey[$moonHouse];
                break;
            default:
                $tags['tpoics'][4]['text']['A'][] = 12040002;
                break;
        }

        //	B、对方个人月三限：（取下单当月起始的 12 个月）
        //①月亮在1/5/7/8/11宫，（与太阳/金星形成0/60/120度）（词条总数5*1条）
        //②月亮1-12宫，与金星和谐/刑克相位（词条总数12条）
        //③月亮1/5/7/11，与木星产生任意相位（词条总数1条）
        //④不满足条件词条（词条总数1条）
        //调用逻辑：
        //  1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 7 号为推运起始时间
        //  2、三限盘取用：以下单当月计 12 个月为一年，每月从7、14、21日三个盘中取1 个最紧密相位。
        //  3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞条件③
        //  4、词条调用：B 逻辑最终输出多条，首取满足①-③条件的月份，一个月中仅调用1 条，满足条件的月份即可调用，不满足的月份则不调用；
        //  5、若条件同时存在，取用优先级：条件①＞条件②＞条件③＞条件④
        //  6、依次排查 12 个月的相位，若有多个月份满足条件一致，则只取 1 条；若12 个月都不满足条件①-③，则取条件④词条，即 12 个月总共仅 1 条；
        //  7、若连续几个月均满足①-③的同一个条件，则多个月份仅调用 1 个对应词条，不重复调用，并在前面标注满足的年份月份；
        //固定语示例：
        //具体来看，在 XX 年XX 月的时候+词条
        $time = $this->startTime;
        $tag5bTmp = [];
        foreach ($thirdprogressed[1] as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (!isset($tag5bTmp[$date]))
            {
                $tag5bTmp[$date] = [
                    'date' => $date,
                    'house' => $v1MoonHouse,
                    'phase_orb' => 50,
                    'tag' => 4,
                ];
            }
            // 月亮在1/5/7/8/11宫，（与太阳/金星形成0/60/120度）（词条总数5*1条）
            if ($this->isPlanetInHouse($v1['planets'], 1, [1, 5, 7, 8, 11]))
            {
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 0, [0, 60, 120])
                    && ($v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag5bTmp[$date]['phase_orb']))
                {
                    $tag5bTmp[$date]['house'] = $v1MoonHouse;
                    $tag5bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-0']['phase_orb'];
                    $tag5bTmp[$date]['tag'] = 1;
                }
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 120])
                    && ($v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag5bTmp[$date]['phase_orb']))
                {
                    $tag5bTmp[$date]['house'] = $v1MoonHouse;
                    $tag5bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-3']['phase_orb'];
                    $tag5bTmp[$date]['tag'] = 1;
                }
            }
            // 与金星产生任意相位
            if ($this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 90, 120, 180])
                && ($v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag5bTmp[$date]['phase_orb']))
            {
                $tag5bTmp[$date]['house'] = $v1MoonHouse;
                $tag5bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-3']['phase_orb'];
                $tag5bTmp[$date]['tag'] = 2;
            }
            // 月亮 1/5/7/11，（与木星产生任意相位）
            if ($this->isPlanetInHouse($v1['planets'], 1, [1, 5, 7, 11])
                && $this->isPlanetPhasePlanet($v1['planets'], 1, 5, [0, 60, 90, 120, 180])
                && $v1['planets'][1]['phase']['1-5']['phase_orb'] < $tag5bTmp[$date]['phase_orb'])
            {
                $tag5bTmp[$date]['house'] = $v1MoonHouse;
                $tag5bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-5']['phase_orb'];
                $tag5bTmp[$date]['tag'] = 3;
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        foreach ($tag5bTmp as $d => $t5bt)
        {
            switch ($t5bt['tag'])
            {
                case 1:
                    $housesKey = [1 => 0, 5 => 1, 7 => 2, 8 => 3, 11 => 4];
                    $tags['tpoics'][4]['text']['B'][] = [
                        'date' => $d,
                        'code' => 1204010000 + $housesKey[$t5bt['house']],
                    ];
                    break;
                case 2:
                    $tags['tpoics'][4]['text']['B'][] = [
                        'date' => $d,
                        'code' => 1204010100 + $t5bt['house'] - 1,
                    ];
                    break;
                case 3:
                    $housesKey = [1 => 0, 5 => 1, 7 => 2, 11 => 3];
                    $tags['tpoics'][4]['text']['B'][] = [
                        'date' => $d,
                        'code' => 1204010200 + $housesKey[$t5bt['house']],
                    ];
                    break;
                default:
                    break;
            }
        }
        // 若12 个月都不满足条件①-③，则取条件④词条
        if (empty($tags['tpoics'][4]['text']['B']))
        {
            $tags['tpoics'][4]['text']['B'][] = ['date' => '', 'code' => 12040103];
        }

        //主题 6、双方关系修补建议
        //组合次限：（以下订单的当前月开始计 12 个月）
        //①月亮落1-12宫，（词条总数12条）
        //②月亮与日/金/水/木/火/土/天/海/冥任意相位（词总数 1*9条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞条件①
        //4、词条调用：该逻辑最终输出为 2 个词条，首取条件①，再取条件②；选取时间最长的，且＞4 个月的词条；
        //若月份相同时，则优先按照调用原则 3取对应条件词条
        //若12 个月均空相，则取空相在某个宫位持续时间最长的一个条件；若有均等时间，则取2 个条件词条。
        //固定语示例：
        //在接下来一年，如果想要修复你们之间的关系和感情 +词条
        //同时+词条（有第二条词条则显示）
        $time = $this->startTime;
        $tag6 = [];
        $housesArr = [];// 月亮落宫数组
        foreach ($composite_progressions as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            // 月亮落宫位id
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];
            $housesArr[] = $v1MoonHouse;
            // 月亮有相位
            if (!empty($v1['planets'][1]['phase']))
            {
                $phase = [];
                foreach ($v1['planets'][1]['phase'] as $k2 => $v2)
                {
                    if ($v2['id'] > 9) continue;
                    if (empty($phase) || $v2['phase_orb'] < $phase['phase_orb'])
                    {
                        $phase = [
                            'date' => $date,
                            'time' => $time,
                            'moon_house' => $v1MoonHouse,
                            'id' => $v2['id'],
                            'phase_e' => $v2['phase_e'],
                            'phase_orb' => $v2['phase_orb'],
                        ];

                    }
                }
                if (!empty($phase))
                {
                    $tag6[] = $phase;
                }
            }
            $time = strtotime('+1 month', $time);
        }
        // 月亮一直空相
        if (empty($tag6))
        {
            $hcv = array_count_values($housesArr);
            $h = array_search(max($hcv), $hcv, false);
            // + 月亮落宫id
            $tags['tpoics'][5]['text'][] = 1205000000 + $h - 1;
        } else
        {
            $citiao = [];
            foreach ($tag6 as $k1 => $v1)
            {
                if (empty($citiao) || $v1['phase_orb'] < $citiao['phase_orb'])
                {
                    $citiao = $v1;
                }
            }
            $citiao['id'] = $citiao['id'] === 0 ? $citiao['id'] : $citiao['id'] - 1;
            $tags['tpoics'][5]['text'][] = 1205000100 + $citiao['id'];
        }

        return $tags;
    }

    /**
     * 已婚状态
     */
    private function getState4Data()
    {
        $tags = [
            'start_time' => $this->startTime,
            'tpoics' => [
                0 => [
                    'text' => [],
                    'level' => [],
                ],
                1 => [
                    'text' => [],
                    'level' => [],
                ],
                2 => [
                    'text' => [],
                    'level' => [],
                ],
                3 => [
                    'text' => [],
                    'level' => [],
                ],
                4 => [
                    'text' => [],
                    'level' => [],
                ],
                5 => [
                    'text' => [],
                    'level' => [],
                ],
            ],
        ];

        /**
         * 获取当前所需星盘数据
         */
        $astroData = $this->getAstroDatas([
            'natal',
            'profection',
            'firdaria',
            'thirdprogressed',
            'progressions',
            'composite_thirdprogressed',
            'composite_progressions'
        ]);
        $astroData = json_decode(json_encode($astroData, true), true);
        $natal = $astroData['natal'];
        $profection = $astroData['profection'];
        $firdaria = $astroData['firdaria'];
        $thirdprogressed = $astroData['thirdprogressed'];
        $progressions = $astroData['progressions'];
        $composite_thirdprogressed = $astroData['composite_thirdprogressed'];
        $composite_progressions = $astroData['composite_progressions'];

        //主题1：感情升温的月份
        //A、法达星限（调用购买人法达星限）：
        //①若该副限行星为金/月、5R/7R、落5R/7R内、互容接纳5R/7R/57R宫内星（词条总数 1）
        //②若该副限行星被火土天海冥刑克(无互容接纳)、接纳互容火/土(非5/7R，5/7宫内星) （词条总数 1）
        //③非以上情况（词条总数 1）
        //调用逻辑：1、推运时间：按报告解锁时间
        //2、副限取用：需满足解锁月离副限运结束期≥4个月，若不满足则取下一个副限行星
        //3、词条调用：A 逻辑最终输出仅1 个词条，若不满足①②则取③
        //固定语示例：
        //对于你个人而言，接下来一年+词条，在这基础影响之下：
//        $tag1A = $this->getSection1($firdaria[0], $natal[0]);
        // 主题1词条
//        $tags['tpoics'][0]['text']['A'][] = 13000000 + $tag1A;

        //C、组合次限：取1年期（（以下订单的当前月开始计12 个月为 1 年）
        //①月亮在 1、4/5/7、10/8/3、11宫，与（太阳/金星形成0/60/120度）（词条总数 5*1）
        //②月亮在 1、4/5/7、10/8/3、11宫，与（太阳/金星形成90/180度）（词条总数 5*1）
        //③非以上情况（词条总数1 ）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：C 逻辑最终输出仅 1 个词条，首取满足条件①或②的词条，若当年都不满足，则取③的词条，仅一条。
        //5、若 12 个月份中有多个月份满足条件①或②，则取持续月份最多的条件；
        //若满足月份等同，则按照3 的优先排序取用
        //
        //固定语示例：
        //总的来说，对于你们关系而言，在接下来这一年+词条
        $housesKey = [1 => 0, 3 => 4, 4 => 0, 5 => 1, 7 => 2, 8 => 3, 10 => 2, 11 => 4];
        $time = $this->startTime;
        $tag1_B = [
            1 => ['h' => 1, 'c1' => 0, 'c2' => 0, 'c3' => 0], 3 => ['h' => 3, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            4 => ['h' => 4, 'c1' => 0, 'c2' => 0, 'c3' => 0], 5 => ['h' => 5, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            6 => ['h' => 6, 'c1' => 0, 'c2' => 0, 'c3' => 0], 7 => ['h' => 7, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            8 => ['h' => 8, 'c1' => 0, 'c2' => 0, 'c3' => 0], 10 => ['h' => 10, 'c1' => 0, 'c2' => 0, 'c3' => 0],
            11 => ['h' => 11, 'c1' => 0, 'c2' => 0, 'c3' => 0]
        ];
        $tag1B0Num = 0;// 满足条件1的数量
        $tag1B1Num = 0;// 满足条件2的数量
        $tag1B2Num = 0;// 满足条件3的数量
        foreach ($composite_progressions as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            // 反向判断，不在2、9、12宫
            if (!$this->isPlanetInHouse($v1['planets'], 1, [2, 6, 9, 12]))
            {
                if ($this->isPlanetPhasePlanet($v1['planets'], 1, 0, [0, 60, 120])
                    || $this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 120]))
                {
                    $tag1B0Num++;
                    $tag1_B[$v1MoonHouse]['c1']++;
                } elseif ($this->isPlanetPhasePlanet($v1['planets'], 1, 0, [90, 180])
                    || $this->isPlanetPhasePlanet($v1['planets'], 1, 3, [90, 180]))
                {
                    $tag1B1Num++;
                    $tag1_B[$v1MoonHouse]['c2']++;
                } else
                {
                    $tag1B2Num++;
                    $tag1_B[$v1MoonHouse]['c3']++;
                }
            } else
            {
                $tag1B2Num++;
            }
            $time = strtotime('+1 month', $time);
        }
        // 12个月中没有满足条件1和条件2的
        if ($tag1B2Num === 12)
        {
            $tags['tpoics'][0]['text']['B'][] = 13000202;
        } else
        {
            // 重置索引
            $tag1_B = array_merge($tag1_B);
            if ($tag1B0Num > $tag1B1Num)
            {
                $tag1_B = resort($tag1_B, 'c1', 'DESC');
                $key = 1300020000;
            } elseif ($tag1B0Num === $tag1B1Num)
            {
                $tag1_B = resort($tag1_B, 'c1', 'DESC');
                $key = 1300020000;
                $tags['tpoics'][0]['text']['B'][] = $key + $housesKey[$tag1_B[0]['h']];

                $tag1_B = resort($tag1_B, 'c2', 'DESC');
                $key = 1300020100;
            } else
            {
                $tag1_B = resort($tag1_B, 'c2', 'DESC');
                $key = 1300020100;
            }
            $tags['tpoics'][0]['text']['B'][] = $key + $housesKey[$tag1_B[0]['h']];
        }

        //B、组合三限：取 12 个月（以下订单的当前月开始计 12 个月）有图形
        //①月亮在 1、4/5/7、10/8/3、11宫，与太阳/金星/日金形成（0/60/120度） ，不与天、海、冥有 90/180相位 +5分（词条总数 5*3条，调用词条多条）
        //②月亮在 1、4/5/7、10/8/3、11宫，与太阳/金星/日金形成（90/180度 ），不与天、海、冥有 90/180相位 +3分（词条总数 5*3条，调用词条多条）
        //③非以上情况+0 分（词条总数1 条）
        //新增标注：与太阳/金星/日金形成（0/60/120度）或（90/180度 ）的情况具体为：
        //若与日成相，且不与金成相
        //若与金成相，且不与日成相
        //若同时与日金成相，只需满足括弧内相位，不必相同
        //若同时与日金成相，相位分别为（0/60/120度）或（90/180度 ），则取相位容许度最紧密；
        //调用逻辑：
        //1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 7 号为推运起始时间
        //2、组合三限盘取用：以下单当月计 12 个月为一年，每月从7、14、21日三个盘中取1 个最紧密相位。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：B 逻辑最终输出多条，首取满足①、②条件的月份，1 个月份仅调用1 条，满足条件的月份即可调用，不满足的月份则不调用；
        //5、若 12 个月全都不满足①或②，则取③的词条，即 12 个月总共仅 1 条；
        //6、若连续几个月均满足①，或②的同一个条件，则多个月份仅调用 1 个对应词条，不重复调用，并在前面标注满足的年份月份；
        //固定语示例：
        //对于你们双方的关系而言，在接下来一年具体来看，容易出现有利于关系进展的月份是：XX年XX月;
        //在XX年XX月的时候+词条
        $housesKey = ['1' => 0, '3' => 4, '4' => 0, '5' => 1, '7' => 2, '8' => 3, '10' => 2, '11' => 4];
        $planetsKey = ['0' => 0, '3' => 1, '0,3' => 2];
        $time = $this->startTime;
        $tag1cTmp = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (empty($tag1cTmp[$date]))
            {
                $tag1cTmp[$date] = [
                    'date' => $date,
                    'house' => $v1MoonHouse,
                    'phase_id' => null,
                    'phase_e' => null,
                    'phase_orb' => null,
                ];
            }
            if (!$this->isPlanetInHouse($v1['planets'], 1, [2, 6, 9, 12])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 7, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 8, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 9, [90, 180])
            )
            {
                $isPhaseSun = isset($v1['planets'][1]['phase']['1-0']);
                $isPhaseVenu = isset($v1['planets'][1]['phase']['1-3']);
                // 与日金同时成相
                if ($isPhaseSun && $isPhaseVenu)
                {
                    // 与太阳相位更紧密
                    if ($v1['planets'][1]['phase']['1-0']['phase_orb'] <= $v1['planets'][1]['phase']['1-3']['phase_orb'])
                    {
                        if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                        {
                            $tag1cTmp[$date] = [
                                'date' => $date,
                                'house' => $v1MoonHouse,
                                'phase_id' => '0,3',
                                'phase_e' => $v1['planets'][1]['phase']['1-0']['phase_e'],
                                'phase_orb' => $v1['planets'][1]['phase']['1-0']['phase_orb'],
                            ];
                        }
                    }// 与金星相位更紧密
                    else
                    {
                        if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                        {
                            $tag1cTmp[$date] = [
                                'date' => $date,
                                'house' => $v1MoonHouse,
                                'phase_id' => '0,3',
                                'phase_e' => $v1['planets'][1]['phase']['1-3']['phase_e'],
                                'phase_orb' => $v1['planets'][1]['phase']['1-3']['phase_orb'],
                            ];
                        }
                    }
                }// 仅与太阳成相
                elseif ($isPhaseSun && !$isPhaseVenu)
                {
                    if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                    {
                        $tag1cTmp[$date] = [
                            'date' => $date,
                            'house' => $v1MoonHouse,
                            'phase_id' => 0,
                            'phase_e' => $v1['planets'][1]['phase']['1-0']['phase_e'],
                            'phase_orb' => $v1['planets'][1]['phase']['1-0']['phase_orb'],
                        ];
                    }
                }// 仅与金星成相
                elseif (!$isPhaseSun && $isPhaseVenu)
                {
                    if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                    {
                        $tag1cTmp[$date] = [
                            'date' => $date,
                            'house' => $v1MoonHouse,
                            'phase_id' => 3,
                            'phase_e' => $v1['planets'][1]['phase']['1-3']['phase_e'],
                            'phase_orb' => $v1['planets'][1]['phase']['1-3']['phase_orb'],
                        ];
                    }
                }
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        $num = 0;
        foreach ($tag1cTmp as $d => $tct)
        {
            if (in_array($tct['phase_e'], [0, 60, 120], true))
            {
                $num++;
                $s = 5;
                $tags['tpoics'][0]['text']['C'][] = [
                    'date' => $d,
                    'code' => 130001000000 + $housesKey[$tct['house']] * 100 + $planetsKey[$tct['phase_id']],
                ];
            } elseif ($tct['phase_e'] !== null)
            {
                $num++;
                $s = 3;
                $tags['tpoics'][0]['text']['C'][] = [
                    'date' => $d,
                    'code' => 130001010000 + $housesKey[$tct['house']] * 100 + $planetsKey[$tct['phase_id']],
                ];
            } else
            {
                $s = 0;
            }
            $tags['tpoics'][0]['level'][] = $s;
        }
        // 12个月前两个条件都不满足，则取条件3，仅出一个词条
        if ($num === 0)
        {
            $tags['tpoics'][0]['text']['C'][] = ['date' => '', 'code' => 13000102];
        }

        //主题 2、感情受阻的月份
        //B、组合次限：取1 年期（以下订单的当前月开始计12 个月为 1 年）
        //①月亮在 2/1、5、9/6、10/7/4、8/12宫，与（火土/火星/土星）形成任意相位，不与日金有相位+3分（词条总数 6*1）
        //②月亮在 2/1、5、9/6、10/7/4、8/12宫，与（天/海/冥）形成任意相位，不与日金有相位+5 分（词条总数6*1）
        //③非以上情况+0 分（调用词条1 条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：B 逻辑最终输出仅 1 个词条；首取满足条件①或②的词条，若当年都不满足，则取③的词条，仅1条。
        //5、若 12 个月份中有多个满足条件①②存在，则取持续月份最多的词条；
        //若满足月份等同，则按照3 的优先排序取用
        //固定语示例：
        //总的来说，对于你们关系而言，在接下来这一年+词条
        $time = $this->startTime;
        $tag2A = [
            ['key' => 0, 'num' => 0, 'data' => []],
            ['key' => 1, 'num' => 0, 'data' => []],
            ['key' => 2, 'num' => 0, 'data' => []],
        ];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (!$this->isPlanetInHouse($v1['planets'], 1, [3, 11])
                && !isset($v1['planets'][1]['phase']['1-0'])
                && !isset($v1['planets'][1]['phase']['1-3']))
            {
                if (isset($v1['planets'][1]['phase']['1-4'])
                    || isset($v1['planets'][1]['phase']['1-6']))
                {
                    $tag2A[0]['num']++;
                    $tag2A[0]['data'][] = $v1MoonHouse;
                } elseif (isset($v1['planets'][1]['phase']['1-7'])
                    || isset($v1['planets'][1]['phase']['1-8'])
                    || isset($v1['planets'][1]['phase']['1-9']))
                {
                    $tag2A[1]['num']++;
                    $tag2A[1]['data'][] = $v1MoonHouse;
                } else
                {
                    $tag2A[2]['num']++;
                    $tag2A[2]['data'][] = $v1MoonHouse;
                }
            } else
            {
                $tag2A[2]['num']++;
                $tag2A[2]['data'][] = $v1MoonHouse;
            }
            $time = strtotime('+1 month', $time);
        }
        if ($tag2A[2]['num'] === 12)
        {
            $tags['tpoics'][1]['text']['A'][] = 13010202;
        } else
        {
            unset($tag2A[2]);
            $tag2A = resort($tag2A, 'num', 'DESC');
            $tag2A0Num = array_count_values($tag2A[0]['data']);
            // 若条件1与条件2次数一样
            if ($tag2A[0]['num'] === $tag2A[1]['num'])
            {
                $hs = array_merge($tag2A[0]['data'], $tag2A[1]['data']);
                $hs_count_value = array_count_values($hs);
                // 查询出现最多次的宫位id
                $hs_more_value = key($hs_count_value);
                $tag2A1Num = array_count_values($tag2A[1]['data']);
                if (isset($tag2A1Num[$hs_more_value]) && $tag2A1Num[$hs_more_value] > $tag2A0Num[$hs_more_value])
                {
                    $tag2A[0] = $tag2A[1];
                    $tag2A0Num = $tag2A1Num;
                }
            }
            $housesKey = ['1' => 1, '2' => 0, '4' => 4, '5' => 1, '6' => 2, '7' => 3, '8' => 4, '9' => 1, '10' => 2, '12' => 5];
            $tags['tpoics'][1]['text']['A'][] = 1301020000 + $tag2A[0]['key'] * 100 + $housesKey[key($tag2A0Num)];
        }

        //B、组合三限：取 12 个月（以下订单的当前月开始计 12 个月）有图形
        //①月亮在 2/1、5、9/6、10/7/4、8/12宫，与（火星/土星）形成任意相位，不与日、金有相位（词条总数6*1条）+3分
        //②月亮在 2/1、5、9/6、10/7/4、8/12宫，与（天/海/冥）形成任意相位，不与日、金有相位（词条总数6*1条）+5 分
        //③非以上情况+0 分（词条总数1 ）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 7 号为推运起始时间
        //2、组合三限盘取用：以下单当月计 12 个月为一年，每月从7、14、21日三个盘中取1 个最紧密相位。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //4、词条调用：A 逻辑最终输出多条，首取满足①②条件的月份，1 个月份仅调用1 条，满足条件的月份即可调用，不满足则不调用；
        //5、若 12 个月都不满足①或②，则取③的词条，仅 1 条；
        //6、若连续几个月均满足①，或②的同一条件，则直接仅调用 1 个对应词条，不重复调用，在前面标注满足的年份；
        //固定语示例：
        //对于你们双方的关系而言，具体来看在接下来一年，容易出现不利于关系进展的月份是：XX年XX月;
        //在XX年XX月+词条
        $time = $this->startTime;
        $tag2bTmp = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            $tag2bTmp[$date] = [
                'date' => $date,
                'house' => $v1MoonHouse,
                'phase_id' => null,
                'phase_e' => null,
                'phase_orb' => null,
            ];
            // 不与日金成相
            if (!$this->isPlanetInHouse($v1['planets'], 1, [3])
                && (!isset($v1['planets'][1]['phase']['1-0'])
                    || $this->checkMordenPhase($v1['planets'][1]['phase']['1-0']['phase_e'], $v1['planets'][1]['phase']['1-0']['phase_orb']))
                && (!isset($v1['planets'][1]['phase']['1-3'])
                    || $this->checkMordenPhase($v1['planets'][1]['phase']['1-3']['phase_e'], $v1['planets'][1]['phase']['1-3']['phase_orb'])))
            {
                if (isset($v1['planets'][1]['phase']['1-4'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-4']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 4;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-4']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-4']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-6'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-6']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 6;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-6']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-6']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-7'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-7']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 7;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-7']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-7']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-8'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-8']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 8;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-8']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-8']['phase_orb'];
                } elseif (isset($v1['planets'][1]['phase']['1-9'])
                    && ($tag2bTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-9']['phase_orb'] < $tag2bTmp[$date]['phase_orb']))
                {
                    $tag2bTmp[$date]['phase_id'] = 9;
                    $tag2bTmp[$date]['phase_e'] = $v1['planets'][1]['phase']['1-9']['phase_e'];
                    $tag2bTmp[$date]['phase_orb'] = $v1['planets'][1]['phase']['1-9']['phase_orb'];
                }
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        $nullNum = 0;
        $housesKey = ['1' => 1, '2' => 0, '4' => 4, '5' => 1, '6' => 2, '7' => 3, '8' => 4, '9' => 1, '10' => 2, '11' => 1, '12' => 5];
        foreach ($tag2bTmp as $d => $t2bt)
        {
            $s = 0;
            if ($t2bt['phase_id'] !== null && (empty($tmp) || $t2bt['phase_orb'] < $tmp['phase_orb']))
            {
                $tmp = $t2bt;
            }
            if (in_array($t2bt['phase_id'], [4, 6], true))
            {
                $s = 3;
                $tags['tpoics'][1]['text']['B'][] = [
                    'date' => $d,
                    'code' => 1301000000 + $housesKey[$t2bt['house']],
                ];
            } elseif (in_array($t2bt['phase_id'], [7, 8, 9], true))
            {
                $s = 5;
                $tags['tpoics'][1]['text']['B'][] = [
                    'date' => $d,
                    'code' => 1301000100 + $housesKey[$t2bt['house']],
                ];
            } else
            {
                $nullNum++;
            }
            $tags['tpoics'][1]['level'][] = $s;
        }
        if ($nullNum === 12)
        {
            $tags['tpoics'][1]['text']['B'][] = [
                'date' => '',
                'code' => 13010002
            ];
        }

        //C、若主题1的 C、主题2的 B 出现相同月份，则单出1 个词条
        //固定语示例：
        //需要注意在 XX 月份的日子+词条
        if (!empty($tags['tpoics'][0]['text']['C']) && !empty($tags['tpoics'][1]['text']['B']))
        {
            $sameMonth = [];
            foreach ($tags['tpoics'][0]['text']['C'] as $k1 => $t2a)
            {
                foreach ($tags['tpoics'][1]['text']['B'] as $k2 => $t2b)
                {
                    if ($t2a['date'] === $t2b['date'])
                    {
                        $sameMonth[] = $t2a['date'];
                    }
                }
            }
            if (!empty($sameMonth))
            {
                $tags['tpoics'][1]['text']['C'][] = [
                    'date_list' => $sameMonth,
                    'code' => 130101
                ];
            } else
            {
                $tags['tpoics'][1]['text']['C'] = [];
            }
        } else
        {
            $tags['tpoics'][1]['text']['C'] = [];
        }

        //主题 3、感情面临哪些挑战
        //组合次限：（以下订单的当前月开始计 12 个月）
        //①月亮落1-12宫，与日、金/水、木/火、土/天、海、冥的（0/90/180）（词条总数 12*4条）
        //②月亮在1-12宫（词条总数12条）
        //③月亮空相（词条总数 1条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个组合次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相，且持续时间＞4 个月
        //4、词条调用：该逻辑最终输出仅 1 个词条，首看是否满足条件③，若不满足③条件，则取①条件，若都不满足③或①的条件，则取②。
        //5、若 12 个月份中有多个月份满足条件①或②，则取持续月份最多的条件；
        //若满足月份等同，则按照3 的优先排序取用
        //固定语示例：
        //在接下来一年里，你们的婚姻关系面临的挑战是+词条
        $time = $this->startTime;
        $tag3 = [];
        $nullNum = 0;
        $housesArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (empty($v1['planets'][1]['phase']))
            {
                $nullNum++;
            } else
            {
                foreach ($v1['planets'][1]['phase'] as $k2 => $phase)
                {
                    if ($phase['id'] > 9)
                    {
                        unset($v1['planets'][1]['phase'][$k2]);
                    }
                }
                $housesArr[$v1MoonHouse]++;
                if (count($v1['planets'][1]['phase']) > 0)
                {
                    $v1MoonPhase = resort(array_values($v1['planets'][1]['phase']), 'phase_orb', 'ASC');
                    $tag3[0][] = [
                        'date' => $date,
                        'house' => $v1MoonHouse,
                        'phase_id' => $v1MoonPhase[0]['id'],
                    ];
                } else
                {
                    $nullNum++;
                    $tag3[1][] = [
                        'date' => $date,
                        'house' => $v1MoonHouse,
                        'phase_id' => null,
                    ];
                }
            }
            $time = strtotime('+1 month', $time);
        }
        // 若12个月均为空相
        if ($nullNum === 12)
        {
            $tags['tpoics'][2]['text'][] = 13020002;
        } else
        {
            if (isset($tag3[0], $tag3[1]) && count($tag3[0]) >= count($tag3[1]))
            {
                $tag3[0] = $tag3[1];
            }
            // 获取持续最多的宫位
            $maxHouse = array_search(max($housesArr), $housesArr, true);
            $phaseNum = 0;
            $phaseArray = [];
            if (isset($tag3[0]) && !empty($tag3[0]))
            {
                foreach ($tag3[0] as $k1 => $v1)
                {
                    if ($v1['house'] === $maxHouse && $v1['phase_id'] !== null)
                    {
                        $phaseNum++;
                        $phaseArray[] = $v1['phase_id'];
                    }
                }
            }
            if ($phaseNum)
            {
                $morePhasePlanets = array_count_values($phaseArray);
                $morePhasePlanet = array_search(max($morePhasePlanets), $morePhasePlanets, true);
                $phasePlanetArray = [0 => 0, 2 => 1, 3 => 0, 4 => 2, 5 => 1, 6 => 2, 7 => 3, 8 => 3, 9 => 3];
                $tags['tpoics'][2]['text'][] = 130200000000 + ($maxHouse - 1) * 100 + $phasePlanetArray[$morePhasePlanet];
            } else
            {
                $tags['tpoics'][2]['text'][] = 1302000100 + ($maxHouse - 1);
            }
        }

        //主题 4、出现第三者可能性
        //A、双方本命是否满足以下条件：
        //①（词条总数 1条）
        //  a、5R、5宫内行星刑克 7R、7宫内行星
        //  b、若 5R、5宫内行星为火/土/天/海/冥，落7宫内/合刑克 7R
        //②（词条总数 1条）
        //  a、11R、11宫内行星刑克7R、7宫内行星
        //  b、若11R、11宫内行星为火土天海冥，落7宫内/合刑克 7R
        //③月亮/金星落 12宫，与月亮/金星产生任意相位（词条总数 1条）
        //④其它情况（词条总数 1条）
        //调用逻辑：取满足条件的词条，若①②③均不满足，则取④的词条，需要调用 2 次，你的和对方的。
        //固定语示例：
        //A、在你的本命人生中+词条
        //B、在对方本命人生中+词条
        $natal1House5PhaseHouse7Planets90180 = [];// 档案1中5R、5宫内行星刑克 7R、7宫内行星
        $natal1House5PhaseHouse7Planets090180 = [];// 档案1中5R、5宫内行星为火/土/天/海/冥，落7宫内/合刑克 7R
        $natal1House11PhaseHouse7Planets90180 = [];// 档案1中11R、11宫内行星刑克 7R、7宫内行星
        $natal1House11PhaseHouse7Planets090180 = [];// 档案1中11R、11宫内行星为火/土/天/海/冥，落7宫内/合刑克 7R
        $house5Protect1 = $natal[0]['houses'][5]['protect_ancient_id'];
        $natal1house5PlanetsList = array_column($natal[0]['houses'][5]['in_house_area_planet_info'], 'id');
        $natal1house5PlanetsList[] = $house5Protect1;
        $natal1house5PlanetsList = array_unique($natal1house5PlanetsList);// 5R、5宫内行星
        $house7Protect1 = $natal[0]['houses'][7]['protect_ancient_id'];
        $natal1house7PlanetsList = array_column($natal[0]['houses'][7]['in_house_area_planet_info'], 'id');
        $natal1house7PlanetsList[] = $house7Protect1;
        $natal1house7PlanetsList = array_unique($natal1house7PlanetsList);// 7R、7宫内行星
        $house11Protect1 = $natal[0]['houses'][11]['protect_ancient_id'];
        $natal1house11PlanetsList = array_column($natal[0]['houses'][7]['in_house_area_planet_info'], 'id');
        $natal1house11PlanetsList[] = $house11Protect1;
        $natal1house11PlanetsList = array_unique($natal1house11PlanetsList);// 11R、11宫内行星
        foreach ($natal1house5PlanetsList as $k1 => $v1)
        {
            foreach ($natal1house7PlanetsList as $k2 => $v2)
            {
                if ($v1 !== $v2)
                {
                    if ($this->isPlanetPhasePlanet($natal[0]['planets'], $v1, $v2, [90, 180]))
                    {
                        $natal1House5PhaseHouse7Planets90180[] = $v1;
                    }
                }
            }
            if (in_array($v1, [4, 6, 7, 8, 9], false)
                && ($natal[0]['planets'][$v1]['in_house_id'] === 7 || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, $house7Protect1, [0, 90, 180])))
            {
                $natal1House5PhaseHouse7Planets090180[] = $v1;
            }
        }
        foreach ($natal1house11PlanetsList as $k1 => $v1)
        {
            foreach ($natal1house7PlanetsList as $k2 => $v2)
            {
                if ($v1 !== $v2)
                {
                    if ($this->isPlanetPhasePlanet($natal[0]['planets'], $v1, $v2, [90, 180]))
                    {
                        $natal1House11PhaseHouse7Planets90180[] = $v1;
                    }
                }
            }
            if (in_array($v1, [4, 6, 7, 8, 9], false)
                && ($natal[0]['planets'][$v1]['in_house_id'] === 7 || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, $house7Protect1, [0, 90, 180])))
            {
                $natal1House11PhaseHouse7Planets090180[] = $v1;
            }
        }
        // 档案1满足A的条件①
        if (!empty($natal1House5PhaseHouse7Planets90180) || !empty($natal1House5PhaseHouse7Planets090180))
        {
            $tag4AState1 = 0;
        }// 档案1满足A的条件②
        elseif (!empty($natal1House11PhaseHouse7Planets90180) || !empty($natal1House11PhaseHouse7Planets090180))
        {
            $tag4AState1 = 1;
        }// 档案2满足A的条件③
        elseif (isset($natal[0]['planets'][1]['phase']['1-3']) && ($natal[0]['planets'][1]['in_house_id'] === 12 || $natal[0]['planets'][3]['in_house_id'] === 12))
        {
            $tag4AState1 = 2;
        } else
        {
            $tag4AState1 = 3;
        }

        $natal2House5PhaseHouse7Planets90180 = [];// 档案2中5R、5宫内行星刑克 7R、7宫内行星
        $natal2House5PhaseHouse7Planets090180 = [];// 档案2中5R、5宫内行星为火/土/天/海/冥，落7宫内/合刑克 7R
        $natal2House11PhaseHouse7Planets90180 = [];// 档案2中11R、11宫内行星刑克 7R、7宫内行星
        $natal2House11PhaseHouse7Planets090180 = [];// 档案2中11R、11宫内行星为火/土/天/海/冥，落7宫内/合刑克 7R
        $house5Protect2 = $natal[1]['houses'][5]['protect_ancient_id'];
        $natal2house5PlanetsList = array_column($natal[1]['houses'][5]['in_house_area_planet_info'], 'id');
        $natal2house5PlanetsList[] = $house5Protect2;
        $natal2house5PlanetsList = array_unique($natal2house5PlanetsList);// 5R、5宫内行星
        $house7Protect2 = $natal[1]['houses'][7]['protect_ancient_id'];
        $natal2house7PlanetsList = array_column($natal[1]['houses'][7]['in_house_area_planet_info'], 'id');
        $natal2house7PlanetsList[] = $house7Protect2;
        $natal2house7PlanetsList = array_unique($natal2house7PlanetsList);// 7R、7宫内行星
        $house11Protect2 = $natal[1]['houses'][11]['protect_ancient_id'];
        $natal2house11PlanetsList = array_column($natal[1]['houses'][7]['in_house_area_planet_info'], 'id');
        $natal2house11PlanetsList[] = $house11Protect2;
        $natal2house11PlanetsList = array_unique($natal2house11PlanetsList);// 11R、11宫内行星
        foreach ($natal2house5PlanetsList as $k1 => $v1)
        {
            foreach ($natal2house7PlanetsList as $k2 => $v2)
            {
                if ($v1 !== $v2)
                {
                    if ($this->isPlanetPhasePlanet($natal[1]['planets'], $v1, $v2, [90, 180]))
                    {
                        $natal2House5PhaseHouse7Planets90180[] = $v1;
                    }
                }
            }
            if (in_array($v1, [4, 6, 7, 8, 9], false)
                && ($natal[0]['planets'][$v1]['in_house_id'] === 7 || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, $house7Protect2, [0, 90, 180])))
            {
                $natal2House5PhaseHouse7Planets090180[] = $v1;
            }
        }
        foreach ($natal2house11PlanetsList as $k1 => $v1)
        {
            foreach ($natal2house7PlanetsList as $k2 => $v2)
            {
                if ($v1 !== $v2 && $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, $v2, [90, 180]))
                {
                    $natal2House11PhaseHouse7Planets90180[] = $v1;
                }
            }
            if (in_array($v1, [4, 6, 7, 8, 9], false)
                && ($natal[0]['planets'][$v1]['in_house_id'] === 7 || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, $house7Protect2, [0, 90, 180])))
            {
                $natal2House11PhaseHouse7Planets090180[] = $v1;
            }
        }
        // 档案2满足A的条件①
        if (!empty($natal2House5PhaseHouse7Planets90180) || !empty($natal2House5PhaseHouse7Planets090180))
        {
            $tag4AState2 = 0;
        }// 档案2满足A的条件②
        elseif (!empty($natal2House11PhaseHouse7Planets90180) || !empty($natal2House11PhaseHouse7Planets090180))
        {
            $tag4AState2 = 1;
        }// 档案2满足A的条件③
        elseif (isset($natal[1]['planets'][1]['phase']['1-3']) && ($natal[1]['planets'][1]['in_house_id'] === 12 || $natal[1]['planets'][3]['in_house_id'] === 12))
        {
            $tag4AState2 = 2;
        } else
        {
            $tag4AState2 = 3;
        }

        $tags['tpoics'][3]['text']['A'][] = 13030000 + $tag4AState1;
        $tags['tpoics'][3]['text']['A'][] = 13030000 + $tag4AState2;

        //B、双方法达星限：（取下单当前年）
        //①
        //  a、法达副限行星为 5R、5宫内行星刑克 7R、7宫内行星（词条总数 1条）
        //  b、法达副限行星为 5R、5宫内行星且为火土天海冥之一，落7宫内/合刑克7R（词条总数 1条）
        //  c、法达副限行星接纳互容5R、5宫内行星，且5R、5宫内行星刑克 7R、7宫内行星（词条总数 1条）
        //②
        //  a、法达副限行星为11R、11宫内行星刑克7R、7宫内行星（词条总数 1条）
        //  b、法达副限行星为 11R、11宫内行星  且  为火土天海冥之一，落7宫内/合刑克7R（词条总数 1条）
        //  c、法达副限行星接纳互容11R、11 宫内行星，且11R、11宫内行星刑克7R、7宫内行星（词条总数 1条）
        //③
        //  a、法达副限行星为月亮/金星落 12 宫，与月亮/金星产生任意相位（词条总数 1条）
        //  b、法达副限行星接纳互容12 宫的月亮/金星，且12 宫的月亮/金星与月亮/金星产生任意相位（词条总数 1条）
        //④其它情况（词条总数 1条）
        //调用逻辑：①b＞c＞a   ②b＞c＞a
        //3、词条调用：B 逻辑最终输出仅1 个词条，若不满足①②③则取④
        //4、需要调用 2 次，你的和对方的。
        //固定语示例：
        //A、从你的运势层面来看，在接下来一年你的+词条
        //B、从对方的运势层面来看，在接下来一年对方的+词条
        $tag4BState1 = 3;// 档案1满足的条件
        $tag4BState2 = 3;// 档案2满足的条件
        $firdariaSubLuck1 = $firdaria[0]['firdaria']['sub_luck'];// 档案1的法达副限行星
        $firdariaSubLuck2 = $firdaria[1]['firdaria']['sub_luck'];// 档案2的法达副限行星
        // 档案1法达副限星体互容接纳的行星
        $firdariaSubLuck1Charas = $this->getPlanetReceptOrMutualReceptData($firdariaSubLuck1, $natal[0]['characteristic']);
        // 档案1法达副限星体互容接纳的行星
        $firdariaSubLuck2Charas = $this->getPlanetReceptOrMutualReceptData($firdariaSubLuck2, $natal[0]['characteristic']);
        if ($tag4BState1 === 3)
        {
            // ①b、法达副限行星为 5R、5宫内行星且为火土天海冥之一，落7宫内/合刑克7R
            foreach ([4, 6, 7, 8, 9] as $v1)
            {
                if ($v1 === $firdariaSubLuck1
                    && ($natal[0]['planets'][$v1]['in_house_id'] === 5 || $house5Protect1 === $v1)
                    && ($natal[0]['planets'][$v1]['in_house_id'] === 7 || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, $house7Protect1, [0, 90, 180])))
                {
                    $tag4BState1 = 0;
                    $tags['tpoics'][3]['text']['B'][] = 1303010001;
                    break;
                }
            }
        }
        // 5R、5宫内行星刑克 7R、7宫内行星
        if (!empty($natal1House5PhaseHouse7Planets90180))
        {
            // ①c、法达副限行星接纳互容5R、5宫内行星
            if (!empty(array_intersect($firdariaSubLuck1Charas, $natal1House5PhaseHouse7Planets90180)))
            {
                $tag4BState1 = 0;
                $tags['tpoics'][3]['text']['B'][] = 1303010002;
            } // ①a、法达副限行星为 5R、5宫内行星
            elseif (in_array($firdariaSubLuck1, $natal1House5PhaseHouse7Planets90180, false))
            {
                $tag4BState1 = 0;
                $tags['tpoics'][3]['text']['B'][] = 1303010000;
            }
        }
        if ($tag4BState1 === 3)
        {
            // ②b、法达副限行星为 5R、5宫内行星且为火土天海冥之一，落7宫内/合刑克7R
            foreach ([4, 6, 7, 8, 9] as $v1)
            {
                if ($v1 === $firdariaSubLuck1
                    && ($natal[0]['planets'][$v1]['in_house_id'] === 11 || $house11Protect1 === $v1)
                    && ($natal[0]['planets'][$v1]['in_house_id'] === 7 || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, $house7Protect1, [0, 90, 180])))
                {
                    $tag4BState1 = 1;
                    $tags['tpoics'][3]['text']['B'][] = 1303010101;
                    break;
                }
            }
        }
        // 11R、11宫内行星刑克 7R、7宫内行星
        if ($tag4BState1 === 3 && !empty($natal1House11PhaseHouse7Planets90180))
        {
            // ②c、法达副限行星接纳互容11R、11宫内行星
            if (!empty(array_intersect($firdariaSubLuck1Charas, $natal1House11PhaseHouse7Planets90180)))
            {
                $tag4BState1 = 1;
                $tags['tpoics'][3]['text']['B'][] = 1303010102;
            } // ②a、法达副限行星为 11R、11宫内行星
            elseif (in_array($firdariaSubLuck1, $natal1House11PhaseHouse7Planets90180, false))
            {
                $tag4BState1 = 1;
                $tags['tpoics'][3]['text']['B'][] = 1303010100;
            }
        }
        // 月亮/金星落12宫，与月亮/金星产生任意相位
        if (isset($natal[0]['planets'][1]['phase']['1-3']))
        {
            // ③b、法达副限行星接纳互容12 宫的月亮/金星
            if (($natal[0]['planets'][1]['in_house_id'] === 12 && in_array(1, $firdariaSubLuck1Charas, false))
                || ($natal[0]['planets'][3]['in_house_id'] === 12 && in_array(3, $firdariaSubLuck1Charas, false)))
            {
                $tag4BState1 = 2;
                $tags['tpoics'][3]['text']['B'][] = 1303010200;
            } // ③a、法达副限行星为月亮/金星落 12 宫
            elseif (($natal[0]['planets'][1]['in_house_id'] === 12 && $firdariaSubLuck1 === 1)
                || ($natal[0]['planets'][3]['in_house_id'] === 12 && $firdariaSubLuck1 === 3))
            {
                $tag4BState1 = 2;
                $tags['tpoics'][3]['text']['B'][] = 1303010201;
            }
        }
        if ($tag4BState1 === 3)
        {
            $tags['tpoics'][3]['text']['B'][] = 13030103;
        }

        if ($tag4BState2 === 3)
        {
            // ①b、法达副限行星为 5R、5宫内行星且为火土天海冥之一，落7宫内/合刑克7R
            foreach ([4, 6, 7, 8, 9] as $v1)
            {
                if ($v1 === $firdariaSubLuck2
                    && ($natal[1]['planets'][$v1]['in_house_id'] === 5 || $house5Protect2 === $v1)
                    && ($natal[1]['planets'][$v1]['in_house_id'] === 7 || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, $house7Protect2, [0, 90, 180])))
                {
                    $tag4BState2 = 0;
                    $tags['tpoics'][3]['text']['B'][] = 1303010001;
                    break;
                }
            }
        }
        // 5R、5宫内行星刑克 7R、7宫内行星
        if (!empty($natal2House5PhaseHouse7Planets90180))
        {
            // ①c、法达副限行星接纳互容5R、5宫内行星
            if (!empty(array_intersect($firdariaSubLuck2Charas, $natal2House5PhaseHouse7Planets90180)))
            {
                $tag4BState2 = 0;
                $tags['tpoics'][3]['text']['B'][] = 1303010002;
            } // ①a、法达副限行星为 5R、5宫内行星
            elseif (in_array($firdariaSubLuck2, $natal2House5PhaseHouse7Planets90180, false))
            {
                $tag4BState2 = 0;
                $tags['tpoics'][3]['text']['B'][] = 1303010000;
            }
        }
        if ($tag4BState2 === 3)
        {
            // ②b、法达副限行星为 5R、5宫内行星且为火土天海冥之一，落7宫内/合刑克7R
            foreach ([4, 6, 7, 8, 9] as $v1)
            {
                if ($v1 === $firdariaSubLuck2
                    && ($natal[1]['planets'][$v1]['in_house_id'] === 11 || $house11Protect1 === $v1)
                    && ($natal[1]['planets'][$v1]['in_house_id'] === 7 || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, $house7Protect2, [0, 90, 180])))
                {
                    $tag4BState2 = 1;
                    $tags['tpoics'][3]['text']['B'][] = 1303010101;
                    break;
                }
            }
        }
        // 11R、11宫内行星刑克 7R、7宫内行星
        if ($tag4BState2 === 3 && !empty($natal2House11PhaseHouse7Planets90180))
        {
            // ②c、法达副限行星接纳互容11R、11宫内行星
            if (!empty(array_intersect($firdariaSubLuck2Charas, $natal2House11PhaseHouse7Planets90180)))
            {
                $tag4BState2 = 1;
                $tags['tpoics'][3]['text']['B'][] = 1303010102;
            } // ②a、法达副限行星为 11R、11宫内行星
            elseif (in_array($firdariaSubLuck2, $natal2House11PhaseHouse7Planets90180, false))
            {
                $tag4BState2 = 1;
                $tags['tpoics'][3]['text']['B'][] = 1303010100;
            }
        }
        // 月亮/金星落12宫，与月亮/金星产生任意相位
        if (isset($natal[1]['planets'][1]['phase']['1-3']))
        {
            // ③b、法达副限行星接纳互容12 宫的月亮/金星
            if (($natal[1]['planets'][1]['in_house_id'] === 12 && in_array(1, $firdariaSubLuck2Charas, false))
                || ($natal[1]['planets'][3]['in_house_id'] === 12 && in_array(3, $firdariaSubLuck2Charas, false)))
            {
                $tag4BState2 = 2;
                $tags['tpoics'][3]['text']['B'][] = 1303010200;
            } // ③a、法达副限行星为月亮/金星落 12 宫
            elseif (($natal[1]['planets'][1]['in_house_id'] === 12 && $firdariaSubLuck2 === 1)
                || ($natal[1]['planets'][3]['in_house_id'] === 12 && $firdariaSubLuck2 === 3))
            {
                $tag4BState2 = 2;
                $tags['tpoics'][3]['text']['B'][] = 1303010201;
            }
        }
        if ($tag4BState2 === 3)
        {
            $tags['tpoics'][3]['text']['B'][] = 13030103;
        }

        //C、组合次限：（以下订单的当前月开始计 12 个月）
        //①月亮与金星 0/60/120，再与海王、冥王刑冲 90/180（词条总数 1条）
        //②其它情况（词条总数 1条）
        //调用逻辑：
        //  1、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞空相
        //  2、词条调用：C 逻辑最终输出仅 1 个词条，首取满足①条件，若当年都不满足，则取②的词条，仅 1 条
        //  3、若 12 个月中有多个月份满足条件①或②，则取持续月份最多的条件；
        //若满足月份等同，则按照1 的优先排序取用
        //固定语示例：
        //从你们综合的婚姻关系运势来看+词条
        $tag4C = null;
        $time = $this->startTime;
        foreach ($composite_progressions as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            if ($this->isPlanetPhasePlanet($v1['planets'], 1, 3, [0, 60, 120])
                && ($this->isPlanetPhasePlanet($v1['planets'], 1, 8, [90, 180])
                    || $this->isPlanetPhasePlanet($v1['planets'], 1, 9, [90, 180])))
            {
                $tag4C[$date] = 0;
            }
            $time = strtotime('+1 month', $time);
        }
        // 其他情况
        if (empty($tag4C))
        {
            $tags['tpoics'][3]['text']['C'][] = 13030201;
        } else
        {
            $tags['tpoics'][3]['text']['C'][] = 13030200;
        }

        //主题 5、是否存在离婚风险
        //A、双方本命是否满足以下条件：
        //  ①  a、7R、7 宫内行星被火/土/天/冥刑冲
        //      b、7R、7 宫内行星与火/土/天/冥接纳/互容
        //      c、火/土/天/冥合刑冲DES （词条总数 1条）
        //  ②  a、7R、7 宫内行星被8R/12R、8/12宫内星合刑冲
        //      b、若 8/12宫主星为火土天冥，落 7宫内 （词条总数 1条）
        //  ③1R/1宫内行星与火/土/天/冥合刑冲 （词条总数 1条）
        //  ④其它情况（词条总数 1条）
        //调用逻辑：取满足条件的词条，若①②③均不满足，则取④的词条；需要调用 2 次，你的和对方的。
        //固定语示例：
        //在你的本命人生中，你的+词条
        //在对方的本命人生中，对方的+词条
        $tag5AState1 = 3;// 档案1满足条件A的
        //  ①  a、7R、7 宫内行星被火/土/天/冥刑冲
        //      b、7R、7 宫内行星与火/土/天/冥接纳/互容
        //      c、火/土/天/冥合刑冲DES （词条总数 1条）
        foreach ($natal1house7PlanetsList as $k1 => $v1)
        {
            // 7R、7宫内行星被火/土/天/冥刑冲
            if ($this->isPlanetPhasePlanet($natal[0]['planets'], $v1, 4, [90, 180])
                || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, 6, [90, 180])
                || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, 7, [90, 180])
                || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, 9, [90, 180]))
            {
                $tag5AState1 = 0;
                break;
            }
            $v1Charas = $this->getPlanetReceptOrMutualReceptData($v1, $natal[0]['characteristic']);
            // 互容接纳火土天冥
            if (array_intersect($v1Charas, [4, 6, 7, 9]))
            {
                $tag5AState1 = 0;
                break;
            }
        }
        if ($tag5AState1 === 3)
        {
            // 火/土/天/冥合刑冲DES
            if ($this->isPlanetPhasePlanet($natal[0]['planets'], 4, 19, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[0]['planets'], 6, 19, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[0]['planets'], 7, 19, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[0]['planets'], 9, 19, [0, 90, 180]))
            {
                $tag5AState1 = 0;
            }
        }
        //  ②  a、7R、7 宫内行星被8R/12R、8/12宫内星合刑冲
        $house8Protect1 = $natal[0]['houses'][8]['protect_ancient_id'];// 8宫主
        $house12Protect1 = $natal[0]['houses'][12]['protect_ancient_id'];// 12宫主
        if ($tag5AState1 === 3)
        {
            foreach ($natal1house7PlanetsList as $k1 => $v1)
            {
                if (!empty($natal[0]['planets'][$v1]['phase']))
                {
                    foreach ($natal[0]['planets'][$v1]['phase'] as $k2 => $v2)
                    {
                        if ($v2['id'] === $house8Protect1
                            || $v2['id'] === $house12Protect1
                            || in_array($natal[0]['planets'][$v2['id']]['in_house_id'], [8, 12], false))
                        {
                            $tag5AState1 = 1;
                            break;
                        }
                    }
                }
            }
        }
        // b、若 8/12宫主星为火土天冥，落 7宫内 （词条总数 1条）
        if ($tag5AState1 === 3)
        {
            if ((in_array($house8Protect1, [4, 6, 7, 9], false) && $natal[0]['planets'][$house8Protect1]['in_house_id'] === 7)
                || (in_array($house12Protect1, [4, 6, 7, 9], false) && $natal[0]['planets'][$house12Protect1]['in_house_id'] === 7))
            {
                $tag5AState1 = 1;
            }
        }
        // ③1R/1宫内行星与火/土/天/冥合刑冲 （词条总数 1条）
        if ($tag5AState1 === 3)
        {
            $house1Protect1 = $natal[0]['houses'][1]['protect_ancient_id'];
            $natal1house1PlanetsList = array_column($natal[0]['houses'][1]['in_house_area_planet_info'], 'id');
            $natal1house1PlanetsList[] = $house1Protect1;
            $natal1house1PlanetsList = array_unique($natal1house1PlanetsList);// 1R、1宫内行星
            foreach ($natal1house1PlanetsList as $k1 => $v1)
            {
                if ($this->isPlanetPhasePlanet($natal[0]['planets'], $v1, 4, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, 6, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, 7, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[0]['planets'], $v1, 9, [0, 90, 180]))
                {
                    $tag5AState1 = 2;
                    break;
                }
            }
        }

        $tag5AState2 = 3;// 档案2满足条件A的
        //  ①  a、7R、7 宫内行星被火/土/天/冥刑冲
        //      b、7R、7 宫内行星与火/土/天/冥接纳/互容
        //      c、火/土/天/冥合刑冲DES （词条总数 1条）
        foreach ($natal2house7PlanetsList as $k1 => $v1)
        {
            // 7R、7宫内行星被火/土/天/冥刑冲
            if ($this->isPlanetPhasePlanet($natal[1]['planets'], $v1, 4, [90, 180])
                || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, 6, [90, 180])
                || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, 7, [90, 180])
                || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, 9, [90, 180]))
            {
                $tag5AState2 = 0;
                break;
            }
            $v1Charas = $this->getPlanetReceptOrMutualReceptData($v1, $natal[1]['characteristic']);
            // 互容接纳火土天冥
            if (array_intersect($v1Charas, [4, 6, 7, 9]))
            {
                $tag5AState2 = 0;
                break;
            }
        }
        if ($tag5AState2 === 3)
        {
            // 火/土/天/冥合刑冲DES
            if ($this->isPlanetPhasePlanet($natal[1]['planets'], 4, 19, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[1]['planets'], 6, 19, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[1]['planets'], 7, 19, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[1]['planets'], 9, 19, [0, 90, 180]))
            {
                $tag5AState2 = 0;
            }
        }
        //  ②  a、7R、7 宫内行星被8R/12R、8/12宫内星合刑冲
        $house8Protect2 = $natal[1]['houses'][8]['protect_ancient_id'];// 8宫主
        $house12Protect2 = $natal[1]['houses'][12]['protect_ancient_id'];// 12宫主
        if ($tag5AState2 === 3)
        {
            foreach ($natal2house7PlanetsList as $k1 => $v1)
            {
                if (!empty($natal[1]['planets'][$v1]['phase']))
                {
                    foreach ($natal[1]['planets'][$v1]['phase'] as $k2 => $v2)
                    {
                        if ($v2['id'] === $house8Protect2
                            || $v2['id'] === $house12Protect2
                            || in_array($natal[1]['planets'][$v2['id']]['in_house_id'], [8, 12], false))
                        {
                            $tag5AState2 = 1;
                            break;
                        }
                    }
                }
            }
        }
        // b、若 8/12宫主星为火土天冥，落 7宫内 （词条总数 1条）
        if ($tag5AState2 === 3)
        {
            if ((in_array($house8Protect2, [4, 6, 7, 9], false) && $natal[1]['planets'][$house8Protect2]['in_house_id'] === 7)
                || (in_array($house12Protect2, [4, 6, 7, 9], false) && $natal[1]['planets'][$house12Protect2]['in_house_id'] === 7))
            {
                $tag5AState2 = 1;
            }
        }
        // ③1R/1宫内行星与火/土/天/冥合刑冲 （词条总数 1条）
        if ($tag5AState2 === 3)
        {
            $house1Protect2 = $natal[1]['houses'][1]['protect_ancient_id'];
            $natal2house1PlanetsList = array_column($natal[1]['houses'][1]['in_house_area_planet_info'], 'id');
            $natal2house1PlanetsList[] = $house1Protect2;
            $natal2house1PlanetsList = array_unique($natal2house1PlanetsList);// 1R、1宫内行星
            foreach ($natal2house1PlanetsList as $k1 => $v1)
            {
                if ($this->isPlanetPhasePlanet($natal[1]['planets'], $v1, 4, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, 6, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, 7, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[1]['planets'], $v1, 9, [0, 90, 180]))
                {
                    $tag5AState2 = 2;
                    break;
                }
            }
        }

        $tags['tpoics'][4]['text']['A'][] = 13040000 + $tag5AState1;
        $tags['tpoics'][4]['text']['A'][] = 13040000 + $tag5AState2;

        //B、双方法达星限：
        //①法达副限行星为7R、7R 内行星，与土、天、冥产生0/90/180（词条总数 1条）
        //②法达副限行星与7R、7R 内行星有接纳互容，且7R、7R 内行星与土、天、冥产生0/90/180（词条总数 1条）
        //③法达副限行星为月亮/金星，与土、天、冥产生0/90/180（词条总数 1条）
        //④法达副限行星与月亮/金星有接纳互容，且月亮/金星与土、天、 冥产生0/90/180（词条总数 1条）
        //⑤其它情况（词条总数 1条）
        //调用逻辑：1、推运时间：按报告解锁时间
        //2、副限取用：需满足解锁月离副限运结束期≥4个月，若不满足则取下一个副限行星
        //3、词条调用：B 逻辑需要调用 2 次(购买者和对方)，1 次调用仅输出1 个词条，取满足条件的词条，若①②③④均不满足，则取⑤的词条。
        //固定语示例：
        //从你的运势层面来看，在接下来一年，你的+词条
        //从对方的运势层面来看，在接下来一年，他的+词条
        $tag5BState1 = 4;
        foreach ($natal1house7PlanetsList as $k1 => $v1)
        {
            if ($this->isPlanetPhasePlanet($natal[0], $v1, 6, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[0], $v1, 7, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[0], $v1, 9, [0, 90, 180]))
            {
                // ①法达副限行星为7R、7R 内行星
                if ($v1 === $firdariaSubLuck1)
                {
                    $tag5BState1 = 0;
                    break;
                }
                // ②法达副限行星与7R、7R 内行星有接纳互容
                if ($tag5BState1 === 4 && in_array($v1, $firdariaSubLuck1Charas, false))
                {
                    $tag5BState1 = 1;
                }
            }
        }
        if ($tag5BState1 === 4)
        {
            // 月亮与土、天、冥产生0/90/180
            if ($this->isPlanetPhasePlanet($natal[0]['planets'], 1, 6, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[0]['planets'], 1, 7, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[0]['planets'], 1, 9, [0, 90, 180]))
            {
                // ③法达副限行星为月亮
                if ($firdariaSubLuck1 === 1)
                {
                    $tag5BState1 = 2;
                }// ④法达副限行星与月亮/金星有接纳互容
                elseif (in_array(1, $firdariaSubLuck1Charas, false))
                {
                    $tag5BState1 = 3;
                }
            }
            // 金星与土、天、冥产生0/90/180
            if ($tag5BState1 !== 2 && ($this->isPlanetPhasePlanet($natal[0]['planets'], 3, 6, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[0]['planets'], 3, 7, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[0]['planets'], 3, 9, [0, 90, 180])))
            {
                // ③法达副限行星为金星
                if ($firdariaSubLuck1 === 3)
                {
                    $tag5BState1 = 2;
                }// ④法达副限行星与金星有接纳互容
                elseif (in_array(3, $firdariaSubLuck1Charas, false))
                {
                    $tag5BState1 = 3;
                }
            }
        }

        $tag5BState2 = 4;
        foreach ($natal2house7PlanetsList as $k1 => $v1)
        {
            if ($this->isPlanetPhasePlanet($natal[1], $v1, 6, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[1], $v1, 7, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[1], $v1, 9, [0, 90, 180]))
            {
                // ①法达副限行星为7R、7R 内行星
                if ($v1 === $firdariaSubLuck2)
                {
                    $tag5BState2 = 0;
                    break;
                }
                // ②法达副限行星与7R、7R 内行星有接纳互容
                if ($tag5BState2 === 4 && in_array($v1, $firdariaSubLuck2Charas, false))
                {
                    $tag5BState2 = 1;
                }
            }
        }
        if ($tag5BState2 === 4)
        {
            // 月亮与土、天、冥产生0/90/180
            if ($this->isPlanetPhasePlanet($natal[1]['planets'], 1, 6, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[1]['planets'], 1, 7, [0, 90, 180])
                || $this->isPlanetPhasePlanet($natal[1]['planets'], 1, 9, [0, 90, 180]))
            {
                // ③法达副限行星为月亮
                if ($firdariaSubLuck2 === 1)
                {
                    $tag5BState2 = 2;
                }// ④法达副限行星与月亮/金星有接纳互容
                elseif (in_array(1, $firdariaSubLuck2Charas, false))
                {
                    $tag5BState2 = 3;
                }
            }
            // 金星与土、天、冥产生0/90/180
            if ($tag5BState2 !== 2 && ($this->isPlanetPhasePlanet($natal[1]['planets'], 3, 6, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[1]['planets'], 3, 7, [0, 90, 180])
                    || $this->isPlanetPhasePlanet($natal[1]['planets'], 3, 9, [0, 90, 180])))
            {
                // ③法达副限行星为金星
                if ($firdariaSubLuck2 === 3)
                {
                    $tag5BState2 = 2;
                }// ④法达副限行星与金星有接纳互容
                elseif (in_array(3, $firdariaSubLuck2Charas, false))
                {
                    $tag5BState2 = 3;
                }
            }
        }

        $tags['tpoics'][4]['text']['B'][] = 13040100 + $tag5BState1;
        $tags['tpoics'][4]['text']['B'][] = 13040100 + $tag5BState2;

        //C、组合次限：（以下订单的当前月开始计12 个月）
        //①月亮与土、天、冥产生0/90/180（词条总数 1条）
        //②其它情况（词条总数 1条）
        //调用逻辑：1、推运时间：按报告解锁时间，且需满足解锁日期距离下月1 号大于 10 天，若不满足则从次月 14 号为推运起始时间
        //2、组合次限盘取用：以下单当月计 12 个月为一年，每月14日取1 个最紧密相位，最后从12 个月中，最终只取 1 个次限盘。
        //3、优先排序：取用优先级：精准相位＞弱相位（同度情况：入相＞出相）＞②条件
        //4、词条调用：C 逻辑最终输出仅 1 个词条，首取满足①条件的词条，若当年全部不满足则取②；
        //5、若 12 个月份中有多个月份满足条件①的具体条件，则取持续月份最多的条件；
        //若满足月份等同，则按照3 的优先排序取用
        //固定语示例：
        //从你们婚姻关系的综合运势来看+词条
        $tag5C = null;
        foreach ($composite_progressions as $k1 => $v1)
        {
            if (isset($v1['planets'][1]['phase']['1-7'])
                && in_array($v1['planets'][1]['phase']['1-7']['phase_e'], [0, 90, 180], false)
                && ($tag5C === null || $v1['planets'][1]['phase']['1-7']['phase_orb'] < $tag5C['phase_orb']))
            {
                $tag5C = $v1['planets'][1]['phase']['1-7'];
            }
            if (isset($v1['planets'][1]['phase']['1-8'])
                && in_array($v1['planets'][1]['phase']['1-8']['phase_e'], [0, 90, 180], false)
                && ($tag5C === null || $v1['planets'][1]['phase']['1-8']['phase_orb'] < $tag5C['phase_orb']))
            {
                $tag5C = $v1['planets'][1]['phase']['1-8'];
            }
            if (isset($v1['planets'][1]['phase']['1-9'])
                && in_array($v1['planets'][1]['phase']['1-9']['phase_e'], [0, 90, 180], false)
                && ($tag5C === null || $v1['planets'][1]['phase']['1-9']['phase_orb'] < $tag5C['phase_orb']))
            {
                $tag5C = $v1['planets'][1]['phase']['1-9'];
            }
        }
        if ($tag5C === null)
        {
            $tags['tpoics'][4]['text']['C'][] = 13040200;
        } else
        {
            $tags['tpoics'][4]['text']['C'][] = 13040201;
        }

        //主题 6、婚姻发展建议
        //组合次限：（以下订单的当前月开始计 12 个月）
        //①月亮刑克1-12 宫宫主星（词条总数 12条）
        //②月亮落宫1-12（词条总数 12 条）
        //调用逻辑：
        //4、词条调用：该逻辑最终输出仅 1 个词条，首取满足①条件的词条，若 ①不满足则取②的词条
        //5、若 12 个月份中有多个月份满足条件①或②的具体条件，则取持续月份最多的条件；
        //若满足月份等同，则按照3 的优先排序取用
        //若12 个月均空相，则取空相在某个宫位持续时间最长的一个条件；若有均等时间，则取2 个条件词条。
        //固定语示例：
        //在接下来一年，如果想要继续健康经营和维系你们的婚姻关系+词条
        //同时+词条（有第二条词条则显示）
        $time = $this->startTime;
        $tag6Phases = [];
        $tag6Houses = [
            ['h' => 1, 'num' => 0], ['h' => 2, 'num' => 0], ['h' => 3, 'num' => 0], ['h' => 4, 'num' => 0],
            ['h' => 5, 'num' => 0], ['h' => 6, 'num' => 0], ['h' => 7, 'num' => 0], ['h' => 8, 'num' => 0],
            ['h' => 9, 'num' => 0], ['h' => 10, 'num' => 0], ['h' => 11, 'num' => 0], ['h' => 12, 'num' => 0],
        ];
        foreach ($composite_progressions as $k1 => $v1)
        {
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            $date = date('Y-m', $time);
            if (!empty($v1['planets'][1]['phase']))
            {
                foreach ($v1['planets'][1]['phase'] as $k2 => $v2)
                {
                    if ($v2['id'] < 7 && in_array($v2['phase_e'], [90, 180], false) && (empty($tag6Phases)
                            || (isset($tag6Phases[$date]['phase_orb']) && $v2['phase_orb'] < $tag6Phases[$date]['phase_orb'])))
                    {
                        $v2['houses'] = [];
                        for ($k3 = 1; $k3 < 13; $k3++)
                        {
                            if ($v1['houses'][$k3]['protect_ancient_id'] === $v2['id'])
                            {
                                $v2['houses'][] = $k3;
                            }
                        }
                        if (!empty($v2['houses']))
                        {
                            $tag6Phases[$date] = $v2;
                        }
                    }
                }
            }
            if (!isset($tag6Phases[$date]))
            {
                $tag6Houses[$v1MoonHouse - 1]['num']++;
            }
            $time = strtotime('+1 month', $time);
        }
        $tag6Houses = resort($tag6Houses, 'num', 'DESC');
        // 12个月中月亮都没有刑克宫主星
        if (empty($tag6Phases))
        {
            $tag6Houses = resort($tag6Houses, 'num', 'DESC');

            $tags['tpoics'][5]['text'][] = 1305000100 + $tag6Houses[0]['h'] - 1;

            if ($tag6Houses[0]['num'] === $tag6Houses[1]['num'])
            {
                $tags['tpoics'][5]['text'][] = 1305000100 + $tag6Houses[1]['h'] - 1;
            }
        } else
        {
            // 获取容许度最小的相位
            $minPhase = null;
            foreach ($tag6Phases as $t1 => $v1)
            {
                if ($minPhase === null || $v1['phase_orb'] < $minPhase['phase_orb'])
                {
                    $minPhase = $v1;
                }
            }
            foreach ($minPhase['houses'] as $m)
            {
                $tags['tpoics'][5]['text'][] = 1305000000 + $m - 1;
            }
        }

        return $tags;
    }

    /**
     * 计算行星互容接纳的星体
     * @param int $pid
     * @param array $characteristic
     * @return array
     */
    private function getPlanetReceptOrMutualReceptData($pid = 0, $characteristic = []): array
    {
        $res = [];
        if (!empty($characteristic))
        {
            foreach ($characteristic as $k1 => $v1)
            {
                // 互容或接纳
                if ($k1 === 1 || $k1 === 2)
                {
                    foreach ($v1 as $v2)
                    {
                        if ($pid === $v2['id1'] && !in_array($v2['id2'], $res, false))
                        {
                            $res[] = $v2['id2'];
                        }
                    }

                }
            }
        }
        return $res;
    }

    /**
     * @param $firdaria array 法达盘数据
     * @param $natal array 本命盘数据
     * @return int
     */
    private function getSection1($firdaria, $natal): int
    {
        $firdariaSubLuck = $firdaria['firdaria']['sub_luck'];
        // 检测当前副限运结束时间是否大于4个月，若小于4个月则取下一个
        foreach ($firdaria['firdaria']['details'] as $k1 => $fdd)
        {
            $fddTime = strtotime(str_replace(['年', '月', '日'], ['-', '-', ''], $fdd['main']['end']));
            // 当前法达大运
            if ($fddTime > $this->startTime)
            {
                foreach ($fdd['sub'] as $k2 => $fdds)
                {
                    $fddsTime = strtotime(str_replace(['年', '月', '日'], ['-', '-', ''], $fdds['end']));
                    // 当前法达小运，并且结束时间小于4个月,则取下一个小运
                    if ($fddsTime > $this->startTime && $fddsTime > strtotime('-4 month', $this->startTime))
                    {
                        if (!isset($fdd['sub'][$k2 + 1]))
                        {
                            // TODO 75岁+的特殊处理
                            $firdariaSubLuck = $firdaria['firdaria']['details'][$k1 + 1]['sub'][0]['id'];
                        } else
                        {
                            $firdariaSubLuck = $fdd['sub'][$k2 + 1]['id'];
                        }
                        break 2;
                    }
                }
            }
        }
        $house5Protect = $natal['houses'][5]['protect_ancient_id'];// 本命5宫主
        $house7Protect = $natal['houses'][7]['protect_ancient_id'];// 本命7宫主
        // 副限行星-互容接纳星体去除重复
        $firdariaSubLuckCharas = $this->getPlanetReceptOrMutualReceptData($firdariaSubLuck, $natal['characteristic']);

        $isAccept = false;// 副限行星是否接纳互容5/7宫主
        if (!empty($natal['houses'][5]['in_house_area_planet_info']))
        {
            foreach ($natal['houses'][5]['in_house_area_planet_info'] as $pls5)
            {
                if ($isAccept === false && in_array($pls5['id'], $firdariaSubLuckCharas, false))
                {
                    $isAccept = true;
                }
            }
        }
        if ($isAccept === false && !empty($natal['houses'][7]['in_house_area_planet_info']))
        {
            foreach ($natal['houses'][7]['in_house_area_planet_info'] as $pls7)
            {
                if ($isAccept === false && in_array($pls7['id'], $firdariaSubLuckCharas, false))
                {
                    $isAccept = true;
                }
            }
        }
        if (
            $isAccept === true
            || $firdariaSubLuck === 1
            || $firdariaSubLuck === 3
            || $firdariaSubLuck === $house5Protect
            || $firdariaSubLuck === $house7Protect
            || $this->isPlanetInHouse($firdaria['planets'], $firdariaSubLuck, [5, 7])
            || in_array($house5Protect, $firdariaSubLuckCharas, false)
            || in_array($house7Protect, $firdariaSubLuckCharas, false)
        )
        {
            $res = 0;
        } elseif ((($this->isPlanetPhasePlanet($natal['planets'], $firdariaSubLuck, 4, [90, 180])
                    && !$this->isPlanetReceptOrMutualReceptPlanet($natal['characteristic'], $firdariaSubLuck, 4, [1, 2]))
                || ($this->isPlanetPhasePlanet($natal['planets'], $firdariaSubLuck, 6, [90, 180])
                    && !$this->isPlanetReceptOrMutualReceptPlanet($natal['characteristic'], $firdariaSubLuck, 6, [1, 2]))
                || ($this->isPlanetPhasePlanet($natal['planets'], $firdariaSubLuck, 7, [90, 180])
                    && !$this->isPlanetReceptOrMutualReceptPlanet($natal['characteristic'], $firdariaSubLuck, 7, [1, 2]))
                || ($this->isPlanetPhasePlanet($natal['planets'], $firdariaSubLuck, 8, [90, 180])
                    && !$this->isPlanetReceptOrMutualReceptPlanet($natal['characteristic'], $firdariaSubLuck, 8, [1, 2]))
                || ($this->isPlanetPhasePlanet($natal['planets'], $firdariaSubLuck, 9, [90, 180])
                    && !$this->isPlanetReceptOrMutualReceptPlanet($natal['characteristic'], $firdariaSubLuck, 9, [1, 2])))
            || (($this->isPlanetInHouse($natal['planets'], 4, [5, 7])
                    && $natal['houses'][5]['protect_ancient_id'] !== 4
                    && $natal['houses'][7]['protect_ancient_id'] !== 4
                    && $this->isPlanetReceptOrMutualReceptPlanet($natal['characteristic'], $firdariaSubLuck, 4, [1, 2]))
                || ($this->isPlanetInHouse($natal['planets'], 6, [5, 7])
                    && $natal['houses'][5]['protect_ancient_id'] !== 6
                    && $natal['houses'][7]['protect_ancient_id'] !== 6
                    && $this->isPlanetReceptOrMutualReceptPlanet($natal['characteristic'], $firdariaSubLuck, 6, [1, 2])))
        )
        {
            $res = 1;
        } else
        {
            $res = 2;
        }
        return $res;
    }

    /**
     * 检测现代相位，是否满足现代相位容许
     * @param int $phase 相位度数
     * @param float $phase_orb 相位容许度
     * @return bool true|false
     */
    private function checkMordenPhase($phase, $phase_orb): bool
    {
        $phases = [0, 60, 90, 120, 180];
        $orb = [0 => 6, 60 => 4, 90 => 5, 120 => 5, 180 => 5];
        if (in_array($phase, $phases, false) && $phase_orb <= $orb[$phase])
        {
            return true;
        }
        return false;
    }

    /**
     * 怎么追求ta-最佳追求时间
     */
    public function goodForWoo()
    {
        $tags = [
            'start_time' => $this->startTime,
            'tpoics' => [
                0 => [
                    'text' => [],
                    'level' => [],
                ],
                1 => [
                    'text' => [],
                    'level' => [],
                ],
                2 => [
                    'text' => [],
                    'level' => [],
                ],
                3 => [
                    'text' => [],
                    'level' => [],
                ],
                4 => [
                    'text' => [],
                    'level' => [],
                ],
                5 => [
                    'text' => [],
                    'level' => [],
                ],
            ],
        ];
        $res = [];
        /**
         * 获取当前所需星盘数据
         */
        $astroData = $this->getAstroDatas([
//            'natal',
//            'profection',
//            'firdaria',
//            'thirdprogressed',
//            'progressions',
            'composite_thirdprogressed',
//            'composite_progressions'
        ]);
        $astroData = json_decode(json_encode($astroData, true), true);
//        $natal = $astroData['natal'];
//        $profection = $astroData['profection'];
//        $firdaria = $astroData['firdaria'];
//        $thirdprogressed = $astroData['thirdprogressed'];
//        $progressions = $astroData['progressions'];
        $composite_thirdprogressed = $astroData['composite_thirdprogressed'];
//        $composite_progressions = $astroData['composite_progressions'];
        //	C、组合三限：取 12 个月（以下订单的当前月开始计 12 个月）有图形
        //①月亮在 1、4/5/7、10/6、8/3、11宫，与太阳/金星/日金形成（0/60/120度）（词条总数 5*3条，调用词条多条）
        //②月亮在 1、4/5/7、10/6、8/3、11宫，与太阳/金星/日金形成（90/180度 ）词条总数 5*3条，调用词条多条）
        //③非以上情况+0 分（词条总数1 条）
        //新增标注：与太阳/金星/日金形成（0/60/120度）或（90/180度 ）的情况具体为：
        //若与日成相，且不与金成相
        //若与金成相，且不与日成相
        //若同时与日金成相，只需满足括弧内相位，不必相同
        //若同时与日金成相，相位分别为（0/60/120度）或（90/180度 ），则取相位容许度最紧密；
        //调用逻辑：
        //  1、首取满足①②条件的月份，1 个月份仅调用1 条，满足条件的月份即可调用，不满足则不调用；
        //  2、若 12 个月全都不满足①②，则取③的词条，仅 1 条；
        //  3、若连续几个月均为满足①，或②，则直接仅调用 1 个对应词条，不重复调用，并在前面标注满足的年份月份；
        //  4、优先排序：取用优先级：精准相位＞弱相位（入相＞出相）＞空相
        //		词条示例：在 XX 月，你们之间的关系可以有小幅度的推进，对方可能会对你非常有感觉，尤其是当你们多多交流的时候，更能让对方感觉到你的内在美，因此对你另眼相看
        $housesKey = ['1' => 0, '3' => 4, '4' => 0, '5' => 1, '6' => 3, '7' => 2, '8' => 3, '10' => 2, '11' => 4];
        $planetsKey = ['0' => 0, '3' => 1, '0,3' => 2];
        $time = $this->startTime;
        $tag1cTmp = [];
        foreach ($composite_thirdprogressed as $k1 => $v1)
        {
            $date = date('Y-m', $time);
            $v1MoonHouse = $v1['planets'][1]['in_house_id'];// 月亮落宫位id
            if (empty($tag1cTmp[$date]))
            {
                $tag1cTmp[$date] = [
                    'date' => $date,
                    'house' => $v1MoonHouse,
                    'phase_id' => null,
                    'phase_e' => null,
                    'phase_orb' => null,
                ];
            }
            if (!$this->isPlanetInHouse($v1['planets'], 1, [2, 9, 12])
//                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 4, [90, 180])
//                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 6, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 7, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 8, [90, 180])
                && !$this->isPlanetPhasePlanet($v1['planets'], 1, 9, [90, 180])
            )
            {
                $isPhaseSun = isset($v1['planets'][1]['phase']['1-0']);
                $isPhaseVenu = isset($v1['planets'][1]['phase']['1-3']);
                // 与日金同时成相
                if ($isPhaseSun && $isPhaseVenu)
                {
                    // 与太阳相位更紧密
                    if ($v1['planets'][1]['phase']['1-0']['phase_orb'] <= $v1['planets'][1]['phase']['1-3']['phase_orb'])
                    {
                        if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                        {
                            $tag1cTmp[$date] = [
                                'date' => $date,
                                'house' => $v1MoonHouse,
                                'phase_id' => '0,3',
                                'phase_e' => $v1['planets'][1]['phase']['1-0']['phase_e'],
                                'phase_orb' => $v1['planets'][1]['phase']['1-0']['phase_orb'],
                            ];
                        }
                    }// 与金星相位更紧密
                    else
                    {
                        if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                        {
                            $tag1cTmp[$date] = [
                                'date' => $date,
                                'house' => $v1MoonHouse,
                                'phase_id' => '0,3',
                                'phase_e' => $v1['planets'][1]['phase']['1-3']['phase_e'],
                                'phase_orb' => $v1['planets'][1]['phase']['1-3']['phase_orb'],
                            ];
                        }
                    }
                }// 仅与太阳成相
                elseif ($isPhaseSun && !$isPhaseVenu)
                {
                    if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-0']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                    {
                        $tag1cTmp[$date] = [
                            'date' => $date,
                            'house' => $v1MoonHouse,
                            'phase_id' => 0,
                            'phase_e' => $v1['planets'][1]['phase']['1-0']['phase_e'],
                            'phase_orb' => $v1['planets'][1]['phase']['1-0']['phase_orb'],
                        ];
                    }
                }// 仅与金星成相
                elseif (!$isPhaseSun && $isPhaseVenu)
                {
                    if ($tag1cTmp[$date]['phase_e'] === null || $v1['planets'][1]['phase']['1-3']['phase_orb'] < $tag1cTmp[$date]['phase_orb'])
                    {
                        $tag1cTmp[$date] = [
                            'date' => $date,
                            'house' => $v1MoonHouse,
                            'phase_id' => 3,
                            'phase_e' => $v1['planets'][1]['phase']['1-3']['phase_e'],
                            'phase_orb' => $v1['planets'][1]['phase']['1-3']['phase_orb'],
                        ];
                    }
                }
            }
            // 每个月有三个盘
            if ($k1 % 3 === 2) $time = strtotime('+1 month', $time);
        }
        $num = 0;
        foreach ($tag1cTmp as $d => $tct)
        {
            if (in_array($tct['phase_e'], [0, 60, 120], true))
            {
                $num++;
                $s = 5;
                $tags['tpoics'][0]['text']['C'][] = [
                    'date' => $d,
                    'code' => 100002000000 + $housesKey[$tct['house']] * 100 + $planetsKey[$tct['phase_id']],
                ];
                $res[] = $d;
            } elseif ($tct['phase_e'] !== null)
            {
                $num++;
                $s = 3;
                $tags['tpoics'][0]['text']['C'][] = [
                    'date' => $d,
                    'code' => 100002010000 + $housesKey[$tct['house']] * 100 + $planetsKey[$tct['phase_id']],
                ];
                $res[] = $d;
            } else
            {
                $s = 0;
            }
            $tags['tpoics'][0]['level'][] = $s;
        }
        // 12个月前两个条件都不满足，则取条件3，仅出一个词条
        if ($num === 0)
        {
            $tags['tpoics'][0]['text']['C'][] = ['date' => '', 'code' => 10000202];
        }
        return $res;
    }
}
